From 301d14e1abe30b1a5987c87aeac10e1ff11df529 Mon Sep 17 00:00:00 2001 From: konsoletyper Date: Wed, 19 Feb 2014 13:44:27 +0400 Subject: [PATCH] Most of JavaScriptBody TCK tests pass --- .../java/lang/TAbstractStringBuilder.java | 7 +- .../classlib/java/lang/TAssertionError.java | 60 +++++++++++++++ .../teavm/classlib/java/lang/TCharacter.java | 15 +++- .../org/teavm/classlib/java/lang/TClass.java | 4 + .../org/teavm/classlib/java/lang/TDouble.java | 32 +++++++- .../org/teavm/classlib/java/lang/TError.java | 39 ++++++++++ .../classlib/java/lang/TStringBuilder.java | 6 ++ .../org/teavm/classlib/java/lang/TThread.java | 76 +++++++++++++++++++ .../java/org/teavm/javascript/Renderer.java | 2 + .../html4j/JavaScriptBodyDependency.java | 4 + .../teavm/html4j/JavaScriptBodyGenerator.java | 25 +++++- .../teavm/html4j/JavaScriptConvGenerator.java | 40 ++++++++-- .../html/js/tests/JavaScriptBodyTests.java | 20 ++--- 13 files changed, 307 insertions(+), 23 deletions(-) create mode 100644 teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAssertionError.java create mode 100644 teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TError.java create mode 100644 teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java index c5cacc1e3..48d91f7b0 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java @@ -497,8 +497,11 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ } protected TAbstractStringBuilder append(TObject obj) { - append(TString.wrap(obj != null ? obj.toString() : "null")); - return this; + return append(TString.wrap(obj != null ? obj.toString() : "null")); + } + + protected TAbstractStringBuilder append(boolean b) { + return append(b ? TString.wrap("true") : TString.wrap("false")); } private void ensureCapacity(int capacity) { diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAssertionError.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAssertionError.java new file mode 100644 index 000000000..433078025 --- /dev/null +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAssertionError.java @@ -0,0 +1,60 @@ +/* + * 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; + +/** + * + * @author Alexey Andreev + */ +public class TAssertionError extends TError { + private static final long serialVersionUID = -4113942229209340013L; + + public TAssertionError() { + super(); + } + + public TAssertionError(TString message, TThrowable cause) { + super(message, cause); + } + + public TAssertionError(TObject message) { + super(TString.valueOf(message)); + } + + public TAssertionError(boolean message) { + super(TString.valueOf(message)); + } + + public TAssertionError(int message) { + super(TString.valueOf(message)); + } + + public TAssertionError(char message) { + super(TString.valueOf(message)); + } + + public TAssertionError(long message) { + super(TString.valueOf(message)); + } + + public TAssertionError(float message) { + super(TString.valueOf(message)); + } + + public TAssertionError(double message) { + super(TString.valueOf(message)); + } +} diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TCharacter.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TCharacter.java index 1e96261e6..35313ff34 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TCharacter.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TCharacter.java @@ -23,10 +23,23 @@ import org.teavm.javascript.ni.GeneratedBy; * * @author Alexey Andreev */ -public class TCharacter { +public class TCharacter extends TObject { public static final int MIN_RADIX = 2; public static final int MAX_RADIX = 36; private static int[] digitMapping; + private char value; + + public TCharacter(char value) { + this.value = value; + } + + public char charValue() { + return value; + } + + public static TCharacter valueOf(char value) { + return new TCharacter(value); + } @GeneratedBy(CharacterNativeGenerator.class) public static native char toLowerCase(char ch); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TClass.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TClass.java index 36decfd3a..c9c91049e 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TClass.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TClass.java @@ -67,4 +67,8 @@ public class TClass extends TObject { @InjectedBy(ClassNativeGenerator.class) static native TClass intClass(); + + public boolean desiredAssertionStatus() { + return true; + } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TDouble.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TDouble.java index 72bcb2047..ffa9c8bc1 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TDouble.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TDouble.java @@ -21,7 +21,37 @@ import org.teavm.javascript.ni.GeneratedBy; * * @author Alexey Andreev */ -public class TDouble { +public class TDouble extends TNumber { + private double value; + + public TDouble(double value) { + this.value = value; + } + + @Override + public double doubleValue() { + return value; + } + + @Override + public int intValue() { + return (int)value; + } + + @Override + public long longValue() { + return (long)value; + } + + @Override + public float floatValue() { + return (float)value; + } + + public static TDouble valueOf(double d) { + return new TDouble(d); + } + @GeneratedBy(DoubleNativeGenerator.class) public static native boolean isNaN(double v); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TError.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TError.java new file mode 100644 index 000000000..af016e513 --- /dev/null +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TError.java @@ -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; + +/** + * + * @author Alexey Andreev + */ +public class TError extends TThrowable { + private static final long serialVersionUID = 3256540693876647405L; + + public TError() { + } + + public TError(TString message, TThrowable cause) { + super(message, cause); + } + + public TError(TString message) { + super(message); + } + + public TError(TThrowable cause) { + super(cause); + } +} diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TStringBuilder.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TStringBuilder.java index 017be86fb..2a213f9b1 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TStringBuilder.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TStringBuilder.java @@ -93,4 +93,10 @@ public class TStringBuilder extends TAbstractStringBuilder implements TAppendabl super.append(obj); return this; } + + @Override + public TStringBuilder append(boolean b) { + super.append(b); + return this; + } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java new file mode 100644 index 000000000..b3ff73690 --- /dev/null +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java @@ -0,0 +1,76 @@ +/* + * 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; + +/** + * + * @author Alexey Andreev + */ +public class TThread extends TObject implements TRunnable { + private static TThread currentThread = new TThread(TString.wrap("main")); + private TString name; + private TRunnable target; + + public TThread() { + this(null, null); + } + + public TThread(TString name) { + this(name, null); + } + + public TThread(TRunnable target) { + this(null, target); + } + + public TThread(TString name, TRunnable target) { + this.name = name; + this.target = target; + } + + @Override + public void run() { + if (target != null) { + target.run(); + } + } + + public static TThread currentThread() { + return currentThread; + } + + public TString getName() { + return name; + } + + public static void yield() { + } + + public void interrupt() { + } + + public static boolean interrupted() { + return false; + } + + public boolean isInterrupted() { + return false; + } + + public static int activeCount() { + return 1; + } +} diff --git a/teavm-core/src/main/java/org/teavm/javascript/Renderer.java b/teavm-core/src/main/java/org/teavm/javascript/Renderer.java index bb8fdaa59..0db105659 100644 --- a/teavm-core/src/main/java/org/teavm/javascript/Renderer.java +++ b/teavm-core/src/main/java/org/teavm/javascript/Renderer.java @@ -834,6 +834,8 @@ public class Renderer implements ExprVisitor, StatementVisitor { } else { return "new Long(" + (value & 0xFFFFFFFFL) + ", " + (value >>> 32) + ")"; } + } else if (cst instanceof Character) { + return Integer.toString((Character)cst); } else { return cst.toString(); } diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyDependency.java b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyDependency.java index 27b02be6d..4ca4f5bb3 100644 --- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyDependency.java +++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyDependency.java @@ -86,6 +86,10 @@ public class JavaScriptBodyDependency implements DependencyListener { dependencyChecker.linkMethod(JavaScriptConvGenerator.valueOfIntMethod, DependencyStack.ROOT).use(); dependencyChecker.linkMethod(JavaScriptConvGenerator.booleanValueMethod, DependencyStack.ROOT).use(); dependencyChecker.linkMethod(JavaScriptConvGenerator.valueOfBooleanMethod, DependencyStack.ROOT).use(); + dependencyChecker.linkMethod(JavaScriptConvGenerator.doubleValueMethod, DependencyStack.ROOT).use(); + dependencyChecker.linkMethod(JavaScriptConvGenerator.valueOfDoubleMethod, DependencyStack.ROOT).use(); + dependencyChecker.linkMethod(JavaScriptConvGenerator.charValueMethod, DependencyStack.ROOT).use(); + dependencyChecker.linkMethod(JavaScriptConvGenerator.valueOfCharMethod, DependencyStack.ROOT).use(); } @Override diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyGenerator.java b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyGenerator.java index 6cbebafc4..1e6f755e1 100644 --- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyGenerator.java +++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyGenerator.java @@ -84,8 +84,29 @@ public class JavaScriptBodyGenerator implements Generator { @Override protected CharSequence callMethod(String ident, String fqn, String method, String params) { MethodDescriptor desc = MethodDescriptor.parse(method + params + "V"); MethodReader reader = findMethod(fqn, desc); - return ident == null ? naming.getFullNameFor(reader.getReference()) + "(" : - ident + "." + naming.getNameFor(reader.getReference()) + "("; + StringBuilder sb = new StringBuilder(); + sb.append("(function($this"); + for (int i = 0; i < reader.parameterCount(); ++i) { + sb.append(", ").append("p").append(i); + } + sb.append(") { return ").append(naming.getFullNameFor(JavaScriptConvGenerator.toJsMethod)).append("("); + if (ident == null) { + sb.append(naming.getFullNameFor(reader.getReference())); + } else { + sb.append("$this.").append(naming.getNameFor(reader.getReference())); + } + sb.append("("); + for (int i = 0; i < reader.parameterCount(); ++i) { + if (i > 0) { + sb.append(", "); + } + sb.append(naming.getFullNameFor(JavaScriptConvGenerator.fromJsMethod)).append("(p").append(i) + .append(", ") + .append(Renderer.typeToClsString(naming, reader.parameterType(i))).append(")"); + } + sb.append(")); })("); + sb.append(ident == null ? "null, " : ident); + return sb.toString(); } private MethodReader findMethod(String clsName, MethodDescriptor desc) { while (clsName != null) { diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConvGenerator.java b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConvGenerator.java index 190f129bc..1ef4defb6 100644 --- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConvGenerator.java +++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConvGenerator.java @@ -31,10 +31,18 @@ public class JavaScriptConvGenerator implements Generator { new MethodDescriptor("intValue", ValueType.INTEGER)); static final MethodReference booleanValueMethod = new MethodReference("java.lang.Boolean", new MethodDescriptor("booleanValue", ValueType.BOOLEAN)); + static final MethodReference doubleValueMethod = new MethodReference("java.lang.Double", + new MethodDescriptor("doubleValue", ValueType.DOUBLE)); + static final MethodReference charValueMethod = new MethodReference("java.lang.Character", + new MethodDescriptor("charValue", ValueType.CHARACTER)); static final MethodReference valueOfIntMethod = new MethodReference("java.lang.Integer", new MethodDescriptor("valueOf", ValueType.INTEGER, ValueType.object("java.lang.Integer"))); static final MethodReference valueOfBooleanMethod = new MethodReference("java.lang.Boolean", new MethodDescriptor("valueOf", ValueType.BOOLEAN, ValueType.object("java.lang.Boolean"))); + static final MethodReference valueOfDoubleMethod = new MethodReference("java.lang.Double", + new MethodDescriptor("valueOf", ValueType.DOUBLE, ValueType.object("java.lang.Double"))); + static final MethodReference valueOfCharMethod = new MethodReference("java.lang.Character", + new MethodDescriptor("valueOf", ValueType.CHARACTER, ValueType.object("java.lang.Character"))); private static final ValueType objType = ValueType.object("java.lang.Object"); static final MethodReference toJsMethod = new MethodReference(convCls, new MethodDescriptor( "toJavaScript", objType, objType)); @@ -55,11 +63,12 @@ public class JavaScriptConvGenerator implements Generator { private void generateToJavaScript(GeneratorContext context, SourceWriter writer) throws IOException { String obj = context.getParameterName(1); - writer.append("if (" + obj + " === null) {").softNewLine().indent(); - writer.append("return null;").softNewLine(); + writer.append("if (" + obj + " === null || " + obj + " === undefined) {").softNewLine().indent(); + writer.append("return " + obj + ";").softNewLine(); writer.outdent().append("} else if (typeof " + obj + " === 'number') {").indent().softNewLine(); writer.append("return " + obj + ";").softNewLine(); - writer.outdent().append("} else if (" + obj + ".constructor.$meta.item) {").indent().softNewLine(); + writer.outdent().append("} else if (" + obj + ".constructor.$meta && " + obj + ".constructor.$meta.item) {") + .indent().softNewLine(); writer.append("var arr = new Array(" + obj + ".data.length);").softNewLine(); writer.append("for (var i = 0; i < arr.length; ++i) {").indent().softNewLine(); writer.append("arr[i] = ").appendMethodBody(toJsMethod).append("(" + obj + ".data[i]);").softNewLine(); @@ -70,10 +79,16 @@ public class JavaScriptConvGenerator implements Generator { generateStringToJavaScript(context, writer); writer.outdent().append("} else if (" + obj + ".constructor === ").appendClass("java.lang.Integer") .append(") {").indent().softNewLine(); - writer.append("return ").appendMethodBody(intValueMethod).append("(" + obj + ");").softNewLine(); + writer.append("return ").appendMethodBody(intValueMethod).append("(" + obj + ")|0;").softNewLine(); writer.outdent().append("} else if (" + obj + ".constructor === ").appendClass("java.lang.Boolean") .append(") {").indent().softNewLine(); writer.append("return ").appendMethodBody(booleanValueMethod).append("(" + obj + ")!==0;").softNewLine(); + writer.outdent().append("} else if (" + obj + ".constructor === ").appendClass("java.lang.Double") + .append(") {").indent().softNewLine(); + writer.append("return ").appendMethodBody(doubleValueMethod).append("(" + obj + ");").softNewLine(); + writer.outdent().append("} else if (" + obj + ".constructor === ").appendClass("java.lang.Character") + .append(") {").indent().softNewLine(); + writer.append("return ").appendMethodBody(charValueMethod).append("(" + obj + ");").softNewLine(); writer.outdent().append("} else {").indent().softNewLine(); writer.append("return " + obj + ";").softNewLine(); writer.outdent().append("}").softNewLine(); @@ -84,12 +99,12 @@ public class JavaScriptConvGenerator implements Generator { String type = context.getParameterName(2); writer.append("if (" + obj +" === null || " + obj + " === undefined)").ws().append("{") .softNewLine().indent(); - writer.append("return null;").softNewLine(); + writer.append("return " + obj +";").softNewLine(); writer.outdent().append("} else if (" + type + ".$meta.item) {").indent().softNewLine(); writer.append("var arr = $rt_createArray(" + type + ".$meta.item, " + obj + ".length);").softNewLine(); writer.append("for (var i = 0; i < arr.data.length; ++i) {").indent().softNewLine(); - writer.append("arr.data[i] = ").appendMethodBody(fromJsMethod).append("(" + obj + "[i], " + type + ");") - .softNewLine(); + writer.append("arr.data[i] = ").appendMethodBody(fromJsMethod).append("(" + obj + "[i], " + + type + ".$meta.item);").softNewLine(); writer.outdent().append("}").softNewLine(); writer.append("return arr;").softNewLine(); writer.outdent().append("} else if (" + type + " === ").appendClass("java.lang.String") @@ -98,11 +113,18 @@ public class JavaScriptConvGenerator implements Generator { writer.outdent().append("} else if (" + type + " === ").appendClass("java.lang.Integer") .append(") {").indent().softNewLine(); writer.append("return ").appendMethodBody(valueOfIntMethod).append("(" + obj + ");").softNewLine(); + writer.outdent().append("} else if (" + type + " === ").appendClass("java.lang.Double") + .append(") {").indent().softNewLine(); + writer.append("return ").appendMethodBody(valueOfDoubleMethod).append("(" + obj + ");").softNewLine(); writer.outdent().append("} else if (" + type + " === $rt_intcls()) {").indent().softNewLine(); writer.append("return " + obj + "|0;").softNewLine(); writer.outdent().append("} else if (" + type + " === ").appendClass("java.lang.Boolean") .append(") {").indent().softNewLine(); writer.append("return ").appendMethodBody(valueOfBooleanMethod).append("(" + obj + "?1:0);").softNewLine(); + writer.outdent().append("} else if (" + type + " === ").appendClass("java.lang.Character") + .append(") {").indent().softNewLine(); + writer.append("return ").appendMethodBody(valueOfCharMethod).append("(typeof " + obj + " === 'number' ? " + + obj + "0xFFFF : " + obj + ".charCodeAt(0));").softNewLine(); writer.outdent().append("} else if (" + type + " === $rt_booleancls()) {").indent().softNewLine(); writer.append("return " + obj + "?1:0;").softNewLine(); writer.outdent().append("} else if (" + obj + " instanceof Array) {").indent().softNewLine(); @@ -112,9 +134,13 @@ public class JavaScriptConvGenerator implements Generator { .softNewLine(); writer.outdent().append("}").softNewLine(); writer.append("return arr;").softNewLine(); + writer.outdent().append("} else if (typeof " + obj + " === 'string') {").indent().softNewLine(); + writer.append("return $rt_str(" + obj + ");").softNewLine(); writer.outdent().append("} else if (typeof " + obj + " === 'number') {").indent().softNewLine(); writer.append("if (" + obj + "|0 === " + obj + ") {").indent().softNewLine(); writer.append("return ").appendMethodBody(valueOfIntMethod).append("(" + obj + ");").softNewLine(); + writer.outdent().append("} else {").indent().softNewLine(); + writer.append("return ").appendMethodBody(valueOfDoubleMethod).append("(" + obj + ");").softNewLine(); writer.outdent().append("}").softNewLine(); writer.outdent().append("} else if (typeof " + obj + " === 'boolean') {").indent().softNewLine(); writer.append("return ").appendMethodBody(valueOfBooleanMethod).append("(" + obj + "?1:0);").softNewLine(); diff --git a/teavm-html4j/src/test/java/net/java/html/js/tests/JavaScriptBodyTests.java b/teavm-html4j/src/test/java/net/java/html/js/tests/JavaScriptBodyTests.java index bb305d6da..520e8fdab 100644 --- a/teavm-html4j/src/test/java/net/java/html/js/tests/JavaScriptBodyTests.java +++ b/teavm-html4j/src/test/java/net/java/html/js/tests/JavaScriptBodyTests.java @@ -93,14 +93,14 @@ public class JavaScriptBodyTests { assertEquals(1, run.cnt); } - /*@Test public void typeOfCharacter() { + @Test public void typeOfCharacter() { String charType = Bodies.typeof('a', false); assertEquals("number", charType); - }*/ + } @Test public void typeOfBoolean() { String booleanType = Bodies.typeof(true, false); - assertEquals("boolean", equals(booleanType)); + assertEquals("boolean", booleanType); } @Test public void typeOfPrimitiveBoolean() { @@ -110,7 +110,7 @@ public class JavaScriptBodyTests { @Test public void typeOfInteger() { String intType = Bodies.typeof(1, false); - assertEquals("number", equals(intType)); + assertEquals("number", intType); } @Test public void typeOfString() { @@ -118,10 +118,10 @@ public class JavaScriptBodyTests { assertEquals("string", strType); } - /*@Test public void typeOfDouble() { + @Test public void typeOfDouble() { String doubleType = Bodies.typeof(0.33, false); assertEquals("number", doubleType); - }*/ + } @Test public void typeOfBooleanValueOf() { String booleanType = Bodies.typeof(true, true); @@ -138,10 +138,10 @@ public class JavaScriptBodyTests { assertEquals("string", strType); } - /*@Test public void typeOfDoubleValueOf() { + @Test public void typeOfDoubleValueOf() { String doubleType = Bodies.typeof(0.33, true); assertEquals("number", doubleType); - }*/ + } @Test public void computeInARunnable() { final int[] sum = new int[2]; @@ -156,7 +156,7 @@ public class JavaScriptBodyTests { assertEquals(42, sum[1]); } - /*@Test public void doubleCallbackToRunnable() { + @Test public void doubleCallbackToRunnable() { final R run = new R(); final R r2 = new R(); class First implements Runnable { @@ -313,7 +313,7 @@ public class JavaScriptBodyTests { Thread.sleep(50); } assert l.call == 42 : "Method was called: " + l.call; - }*/ + } private static class R implements Runnable { int cnt;