Adds support of some methods required by latest html4j. See

https://github.com/konsoletyper/teavm/issues/6
This commit is contained in:
konsoletyper 2014-09-02 12:11:13 +04:00
parent b63a6d203f
commit 8dada3b28c
7 changed files with 125 additions and 2 deletions

View File

@ -66,7 +66,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonatypeOssDistMgmtSnapshotsUrl>https://oss.sonatype.org/content/repositories/snapshots/</sonatypeOssDistMgmtSnapshotsUrl> <sonatypeOssDistMgmtSnapshotsUrl>https://oss.sonatype.org/content/repositories/snapshots/</sonatypeOssDistMgmtSnapshotsUrl>
<html4j.version>0.7.5</html4j.version> <html4j.version>0.9</html4j.version>
<jetty.version>9.2.1.v20140609</jetty.version> <jetty.version>9.2.1.v20140609</jetty.version>
<slf4j.version>1.7.7</slf4j.version> <slf4j.version>1.7.7</slf4j.version>
</properties> </properties>

View File

@ -0,0 +1,34 @@
/*
* Copyright 2014 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.classlib.java.io;
import org.teavm.classlib.java.lang.TString;
/**
*
* @author Alexey Andreev
*/
public class TEOFException extends TIOException {
private static final long serialVersionUID = 3045477060413545010L;
public TEOFException() {
super();
}
public TEOFException(TString message) {
super(message);
}
}

View File

@ -163,4 +163,12 @@ public class TClass<T> extends TObject {
@GeneratedBy(ClassNativeGenerator.class) @GeneratedBy(ClassNativeGenerator.class)
@PluggableDependency(ClassNativeGenerator.class) @PluggableDependency(ClassNativeGenerator.class)
public native TClass<?> getDeclaringClass(); public native TClass<?> getDeclaringClass();
@SuppressWarnings("unchecked")
public <U> TClass<? extends U> asSubclass(TClass<U> clazz) {
if (!clazz.isAssignableFrom(this)) {
throw new TClassCastException();
}
return (TClass<? extends U>)this;
}
} }

View File

@ -77,4 +77,8 @@ public class TThread extends TObject implements TRunnable {
public long getId() { public long getId() {
return 1; return 1;
} }
public static boolean holdsLock(@SuppressWarnings("unused") TObject obj) {
return true;
}
} }

View File

@ -0,0 +1,39 @@
/*
* Copyright 2014 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.classlib.java.lang.ref;
import org.teavm.classlib.java.lang.TObject;
/**
*
* @author Alexey Andreev
*/
public abstract class TReference<T> extends TObject {
public T get() {
return null;
}
public void clear() {
}
public boolean isEnqueued() {
return false;
}
public boolean enqueue() {
return false;
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright 2014 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.classlib.java.lang.ref;
/**
*
* @author Alexey Andreev
*/
public class TWeakReference<T> extends TReference<T> {
private T value;
public TWeakReference(T value) {
this.value = value;
}
@Override
public T get() {
return value;
}
@Override
public void clear() {
value = null;
}
}

View File

@ -105,7 +105,7 @@ public class JavaScriptBodyGenerator implements Generator {
.append(Renderer.typeToClsString(naming, reader.parameterType(i))).append(")"); .append(Renderer.typeToClsString(naming, reader.parameterType(i))).append(")");
} }
sb.append(")); })("); sb.append(")); })(");
sb.append(ident == null ? "null, " : ident); sb.append(ident == null ? "null" : ident);
return sb.toString(); return sb.toString();
} }
private MethodReader findMethod(String clsName, MethodDescriptor desc) { private MethodReader findMethod(String clsName, MethodDescriptor desc) {