diff --git a/pom.xml b/pom.xml
index 5fe03e8cd..6937d906f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,6 +82,7 @@
teavm-platform
teavm-cli
teavm-chrome-rdp
+ teavm-tests
diff --git a/teavm-classlib/pom.xml b/teavm-classlib/pom.xml
index 6dac0cd24..2624f6ff9 100644
--- a/teavm-classlib/pom.xml
+++ b/teavm-classlib/pom.xml
@@ -49,6 +49,16 @@
teavm-core
${project.version}
+
+ org.teavm
+ teavm-jso
+ ${project.version}
+
+
+ org.teavm
+ teavm-dom
+ ${project.version}
+
com.google.code.gson
gson
@@ -74,34 +84,6 @@
-
- org.teavm
- teavm-maven-plugin
- ${project.version}
-
-
- org.teavm
- teavm-platform
- ${project.version}
-
-
-
-
- generate-javascript-tests
-
- build-test-javascript
-
- process-test-classes
-
- false
-
- en, en_US, en_GB, ru, ru_RU
-
- ${teavm.classlib.test.incremental}
-
-
-
-
org.codehaus.mojo
exec-maven-plugin
@@ -135,15 +117,6 @@
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- org/teavm/platform/metadata/*.java
-
-
-
org.apache.maven.plugins
maven-source-plugin
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/impl/EnumTransformer.java b/teavm-classlib/src/main/java/org/teavm/classlib/impl/EnumTransformer.java
index 4f6355827..dd4b7e213 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/impl/EnumTransformer.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/impl/EnumTransformer.java
@@ -16,7 +16,7 @@
package org.teavm.classlib.impl;
import org.teavm.diagnostics.Diagnostics;
-import org.teavm.javascript.ni.PreserveOriginalName;
+import org.teavm.javascript.spi.PreserveOriginalName;
import org.teavm.model.*;
/**
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/impl/ServiceLoaderSupport.java b/teavm-classlib/src/main/java/org/teavm/classlib/impl/ServiceLoaderSupport.java
index 48a784c35..0bf342efc 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/impl/ServiceLoaderSupport.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/impl/ServiceLoaderSupport.java
@@ -23,8 +23,8 @@ import java.net.URL;
import java.util.*;
import org.teavm.codegen.SourceWriter;
import org.teavm.dependency.*;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.CallLocation;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodReference;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/CharacterNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/CharacterNativeGenerator.java
index 4031d1cfe..ebae587c6 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/CharacterNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/CharacterNativeGenerator.java
@@ -22,8 +22,8 @@ import org.teavm.codegen.SourceWriter;
import org.teavm.dependency.DependencyAgent;
import org.teavm.dependency.DependencyPlugin;
import org.teavm.dependency.MethodDependency;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.CallLocation;
import org.teavm.model.MethodReference;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ClassNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ClassNativeGenerator.java
index 53d7aba14..cd94de90f 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ClassNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ClassNativeGenerator.java
@@ -20,10 +20,10 @@ import org.teavm.codegen.SourceWriter;
import org.teavm.dependency.DependencyAgent;
import org.teavm.dependency.DependencyPlugin;
import org.teavm.dependency.MethodDependency;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
-import org.teavm.javascript.ni.Injector;
-import org.teavm.javascript.ni.InjectorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
+import org.teavm.javascript.spi.Injector;
+import org.teavm.javascript.spi.InjectorContext;
import org.teavm.model.*;
/**
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ConsoleOutputStreamGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ConsoleOutputStreamGenerator.java
index 8fbd93581..713140245 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ConsoleOutputStreamGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ConsoleOutputStreamGenerator.java
@@ -17,8 +17,8 @@ package org.teavm.classlib.java.lang;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.MethodReference;
/**
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/DoubleNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/DoubleNativeGenerator.java
index 6c30c9617..db26c4338 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/DoubleNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/DoubleNativeGenerator.java
@@ -17,10 +17,10 @@ package org.teavm.classlib.java.lang;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
-import org.teavm.javascript.ni.Injector;
-import org.teavm.javascript.ni.InjectorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
+import org.teavm.javascript.spi.Injector;
+import org.teavm.javascript.spi.InjectorContext;
import org.teavm.model.MethodReference;
/**
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/FloatNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/FloatNativeGenerator.java
index 2ebcd6228..1aca3eb1c 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/FloatNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/FloatNativeGenerator.java
@@ -17,10 +17,10 @@ package org.teavm.classlib.java.lang;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
-import org.teavm.javascript.ni.Injector;
-import org.teavm.javascript.ni.InjectorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
+import org.teavm.javascript.spi.Injector;
+import org.teavm.javascript.spi.InjectorContext;
import org.teavm.model.MethodReference;
/**
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/LongNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/LongNativeGenerator.java
index 4a195bfbf..e82de0450 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/LongNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/LongNativeGenerator.java
@@ -17,8 +17,8 @@ package org.teavm.classlib.java.lang;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.MethodReference;
/**
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/MathNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/MathNativeGenerator.java
index a3805d412..25931041d 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/MathNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/MathNativeGenerator.java
@@ -17,8 +17,8 @@ package org.teavm.classlib.java.lang;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.MethodReference;
/**
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ObjectNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ObjectNativeGenerator.java
index 3176e3319..e95abdc3b 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ObjectNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ObjectNativeGenerator.java
@@ -18,10 +18,10 @@ package org.teavm.classlib.java.lang;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
import org.teavm.dependency.*;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
-import org.teavm.javascript.ni.Injector;
-import org.teavm.javascript.ni.InjectorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
+import org.teavm.javascript.spi.Injector;
+import org.teavm.javascript.spi.InjectorContext;
import org.teavm.model.CallLocation;
import org.teavm.model.MethodReference;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/StringNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/StringNativeGenerator.java
index c2bb09b26..79c131f5c 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/StringNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/StringNativeGenerator.java
@@ -19,8 +19,8 @@ import java.io.IOException;
import org.teavm.dependency.DependencyAgent;
import org.teavm.dependency.DependencyPlugin;
import org.teavm.dependency.MethodDependency;
-import org.teavm.javascript.ni.Injector;
-import org.teavm.javascript.ni.InjectorContext;
+import org.teavm.javascript.spi.Injector;
+import org.teavm.javascript.spi.InjectorContext;
import org.teavm.model.CallLocation;
import org.teavm.model.MethodReference;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/SystemNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/SystemNativeGenerator.java
index 0bbe21f42..5092802ba 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/SystemNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/SystemNativeGenerator.java
@@ -18,8 +18,8 @@ package org.teavm.classlib.java.lang;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
import org.teavm.dependency.*;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.CallLocation;
import org.teavm.model.FieldReference;
import org.teavm.model.MethodReference;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TBoolean.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TBoolean.java
index afe614825..e898feac8 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TBoolean.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TBoolean.java
@@ -16,7 +16,7 @@
package org.teavm.classlib.java.lang;
import org.teavm.classlib.java.io.TSerializable;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
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 032c20fb5..ff32d752a 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
@@ -18,7 +18,7 @@ package org.teavm.classlib.java.lang;
import org.teavm.classlib.impl.charset.UTF16Helper;
import org.teavm.classlib.impl.unicode.UnicodeHelper;
import org.teavm.dependency.PluggableDependency;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
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 94152045c..91ae6d732 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
@@ -16,8 +16,8 @@
package org.teavm.classlib.java.lang;
import org.teavm.dependency.PluggableDependency;
-import org.teavm.javascript.ni.GeneratedBy;
-import org.teavm.javascript.ni.InjectedBy;
+import org.teavm.javascript.spi.GeneratedBy;
+import org.teavm.javascript.spi.InjectedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleOutputStream_stderr.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleOutputStream_stderr.java
index da0d23007..b102af538 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleOutputStream_stderr.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleOutputStream_stderr.java
@@ -17,7 +17,7 @@ package org.teavm.classlib.java.lang;
import org.teavm.classlib.java.io.TIOException;
import org.teavm.classlib.java.io.TOutputStream;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleOutputStream_stdout.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleOutputStream_stdout.java
index df027892f..9abdcb7b4 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleOutputStream_stdout.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TConsoleOutputStream_stdout.java
@@ -17,7 +17,7 @@ package org.teavm.classlib.java.lang;
import org.teavm.classlib.java.io.TIOException;
import org.teavm.classlib.java.io.TOutputStream;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
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 eb085acf8..7e1205acd 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
@@ -15,8 +15,8 @@
*/
package org.teavm.classlib.java.lang;
-import org.teavm.javascript.ni.GeneratedBy;
-import org.teavm.javascript.ni.InjectedBy;
+import org.teavm.javascript.spi.GeneratedBy;
+import org.teavm.javascript.spi.InjectedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TEnum.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TEnum.java
index 38d8ca2c6..9ff6bbb18 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TEnum.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TEnum.java
@@ -16,7 +16,7 @@
package org.teavm.classlib.java.lang;
import org.teavm.classlib.java.io.TSerializable;
-import org.teavm.javascript.ni.Rename;
+import org.teavm.javascript.spi.Rename;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java
index 2a6181ca7..916dcc159 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java
@@ -15,7 +15,7 @@
*/
package org.teavm.classlib.java.lang;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TLong.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TLong.java
index 5c3f71e8c..81d57c910 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TLong.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TLong.java
@@ -15,7 +15,7 @@
*/
package org.teavm.classlib.java.lang;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TMath.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TMath.java
index a74a6574c..016b67253 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TMath.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TMath.java
@@ -15,7 +15,7 @@
*/
package org.teavm.classlib.java.lang;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java
index 6759d3cc7..d3e51b64b 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java
@@ -16,10 +16,10 @@
package org.teavm.classlib.java.lang;
import org.teavm.dependency.PluggableDependency;
-import org.teavm.javascript.ni.GeneratedBy;
-import org.teavm.javascript.ni.InjectedBy;
-import org.teavm.javascript.ni.Rename;
-import org.teavm.javascript.ni.Superclass;
+import org.teavm.javascript.spi.GeneratedBy;
+import org.teavm.javascript.spi.InjectedBy;
+import org.teavm.javascript.spi.Rename;
+import org.teavm.javascript.spi.Superclass;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TRuntimeException.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TRuntimeException.java
index 789487406..80a106bc9 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TRuntimeException.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TRuntimeException.java
@@ -15,7 +15,7 @@
*/
package org.teavm.classlib.java.lang;
-import org.teavm.javascript.ni.Superclass;
+import org.teavm.javascript.spi.Superclass;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TString.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TString.java
index 9d309e31e..a5bbde544 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TString.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TString.java
@@ -24,7 +24,7 @@ import org.teavm.classlib.java.util.THashMap;
import org.teavm.classlib.java.util.TMap;
import org.teavm.classlib.java.util.regex.TPattern;
import org.teavm.dependency.PluggableDependency;
-import org.teavm.javascript.ni.InjectedBy;
+import org.teavm.javascript.spi.InjectedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java
index 3c44a0938..4afab3473 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java
@@ -18,7 +18,7 @@ package org.teavm.classlib.java.lang;
import org.teavm.classlib.java.io.TPrintStream;
import org.teavm.classlib.java.lang.reflect.TArray;
import org.teavm.dependency.PluggableDependency;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
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
index 12ff437f9..08773c211 100644
--- 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
@@ -15,14 +15,18 @@
*/
package org.teavm.classlib.java.lang;
-import org.teavm.javascript.ni.GeneratedBy;
-import org.teavm.runtime.Async;
+import org.teavm.dom.browser.TimerHandler;
+import org.teavm.dom.browser.Window;
+import org.teavm.javascript.spi.Async;
+import org.teavm.jso.JS;
+import org.teavm.platform.async.AsyncCallback;
/**
*
* @author Alexey Andreev
*/
public class TThread extends TObject implements TRunnable {
+ private static Window window = (Window)JS.getGlobal();
private static TThread currentThread = new TThread(TString.wrap("main"));
private TString name;
private TRunnable target;
@@ -60,9 +64,16 @@ public class TThread extends TObject implements TRunnable {
}
@Async
- @GeneratedBy(ThreadNativeGenerator.class)
public static native void yield();
+ private static void yield(final AsyncCallback callback) {
+ window.setTimeout(new TimerHandler() {
+ @Override public void onTimer() {
+ callback.complete(null);
+ }
+ }, 0);
+ }
+
public void interrupt() {
}
@@ -86,11 +97,14 @@ public class TThread extends TObject implements TRunnable {
return true;
}
- public static void sleep(long millis) throws TInterruptedException {
- sleep((double)millis);
- }
-
@Async
- @GeneratedBy(ThreadNativeGenerator.class)
- private static native void sleep(double millis) throws TInterruptedException;
+ public static native void sleep(long millis) throws TInterruptedException;
+
+ private static void sleep(long millis, final AsyncCallback callback) {
+ window.setTimeout(new TimerHandler() {
+ @Override public void onTimer() {
+ callback.complete(null);
+ }
+ }, millis);
+ }
}
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThrowable.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThrowable.java
index 8a01cdb37..b0350ac7f 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThrowable.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThrowable.java
@@ -17,9 +17,9 @@ package org.teavm.classlib.java.lang;
import org.teavm.classlib.java.io.TPrintStream;
import org.teavm.classlib.java.util.TArrays;
-import org.teavm.javascript.ni.Remove;
-import org.teavm.javascript.ni.Rename;
-import org.teavm.javascript.ni.Superclass;
+import org.teavm.javascript.spi.Remove;
+import org.teavm.javascript.spi.Rename;
+import org.teavm.javascript.spi.Superclass;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ThreadNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ThreadNativeGenerator.java
index 3c2c8b5bd..70903835c 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ThreadNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ThreadNativeGenerator.java
@@ -17,8 +17,8 @@ package org.teavm.classlib.java.lang;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.MethodReference;
/**
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/reflect/ArrayNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/reflect/ArrayNativeGenerator.java
index 0f043c3ab..0dfed5b26 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/reflect/ArrayNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/reflect/ArrayNativeGenerator.java
@@ -18,8 +18,8 @@ package org.teavm.classlib.java.lang.reflect;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
import org.teavm.dependency.*;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.CallLocation;
import org.teavm.model.ClassReader;
import org.teavm.model.MethodDescriptor;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/reflect/TArray.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/reflect/TArray.java
index 9c3177aae..7c52cf346 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/reflect/TArray.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/reflect/TArray.java
@@ -17,7 +17,7 @@ package org.teavm.classlib.java.lang.reflect;
import org.teavm.classlib.java.lang.*;
import org.teavm.dependency.PluggableDependency;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/net/TURISyntaxException.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/net/TURISyntaxException.java
index c6ef0a80b..1a688563b 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/net/TURISyntaxException.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/net/TURISyntaxException.java
@@ -21,7 +21,7 @@ import org.teavm.classlib.java.lang.TException;
import org.teavm.classlib.java.lang.TIllegalArgumentException;
import org.teavm.classlib.java.lang.TNullPointerException;
import org.teavm.classlib.java.lang.TString;
-import org.teavm.javascript.ni.Rename;
+import org.teavm.javascript.spi.Rename;
/**
* A {@code URISyntaxException} will be thrown if some information could not be parsed
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/DateNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/DateNativeGenerator.java
index 24488481e..7b49f1b21 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/DateNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/DateNativeGenerator.java
@@ -20,8 +20,8 @@ import org.teavm.codegen.SourceWriter;
import org.teavm.dependency.DependencyAgent;
import org.teavm.dependency.DependencyPlugin;
import org.teavm.dependency.MethodDependency;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.CallLocation;
import org.teavm.model.MethodReference;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/RandomNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/RandomNativeGenerator.java
index c922cf767..4fc673db8 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/RandomNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/RandomNativeGenerator.java
@@ -17,8 +17,8 @@ package org.teavm.classlib.java.util;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.MethodReference;
/**
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TAbstractList.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TAbstractList.java
index d012d7c51..c7b2b4459 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TAbstractList.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TAbstractList.java
@@ -16,7 +16,7 @@
package org.teavm.classlib.java.util;
import org.teavm.classlib.java.lang.*;
-import org.teavm.javascript.ni.Rename;
+import org.teavm.javascript.spi.Rename;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TArrayList.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TArrayList.java
index c411b0f18..43a998c44 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TArrayList.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TArrayList.java
@@ -18,7 +18,7 @@ package org.teavm.classlib.java.util;
import java.util.Arrays;
import org.teavm.classlib.java.io.TSerializable;
import org.teavm.classlib.java.lang.*;
-import org.teavm.javascript.ni.Rename;
+import org.teavm.javascript.spi.Rename;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TBitSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TBitSet.java
index 77eebde48..bafc551b2 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TBitSet.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TBitSet.java
@@ -17,7 +17,7 @@ package org.teavm.classlib.java.util;
import org.teavm.classlib.java.io.TSerializable;
import org.teavm.classlib.java.lang.*;
-import org.teavm.javascript.ni.Rename;
+import org.teavm.javascript.spi.Rename;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TDate.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TDate.java
index 1fae8ebc0..5d14d375b 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TDate.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TDate.java
@@ -18,7 +18,7 @@ package org.teavm.classlib.java.util;
import org.teavm.classlib.java.lang.TComparable;
import org.teavm.classlib.java.lang.TSystem;
import org.teavm.dependency.PluggableDependency;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/THashMap.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/THashMap.java
index 16890395f..4c2b2973d 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/THashMap.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/THashMap.java
@@ -39,7 +39,7 @@ import org.teavm.classlib.java.lang.TCloneNotSupportedException;
import org.teavm.classlib.java.lang.TIllegalArgumentException;
import org.teavm.classlib.java.lang.TIllegalStateException;
import org.teavm.classlib.java.lang.TObject;
-import org.teavm.javascript.ni.Rename;
+import org.teavm.javascript.spi.Rename;
public class THashMap extends TAbstractMap implements TSerializable {
transient int elementCount;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/THashSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/THashSet.java
index e87bf7f42..eff1c5a1e 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/THashSet.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/THashSet.java
@@ -20,7 +20,7 @@ import org.teavm.classlib.java.io.TSerializable;
import org.teavm.classlib.java.lang.TCloneNotSupportedException;
import org.teavm.classlib.java.lang.TCloneable;
import org.teavm.classlib.java.lang.TObject;
-import org.teavm.javascript.ni.Rename;
+import org.teavm.javascript.spi.Rename;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TRandom.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TRandom.java
index 5d71eed1c..864e1270e 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TRandom.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TRandom.java
@@ -18,7 +18,7 @@ package org.teavm.classlib.java.util;
import org.teavm.classlib.java.io.TSerializable;
import org.teavm.classlib.java.lang.TMath;
import org.teavm.classlib.java.lang.TObject;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTimer.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTimer.java
index 4585cec6a..9b1d12049 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTimer.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTimer.java
@@ -19,7 +19,7 @@ import org.teavm.classlib.java.lang.TIllegalStateException;
import org.teavm.classlib.java.lang.TObject;
import org.teavm.classlib.java.lang.TString;
import org.teavm.dependency.PluggableDependency;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TimerNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TimerNativeGenerator.java
index 08ea7f48c..3a376cd1d 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TimerNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TimerNativeGenerator.java
@@ -21,8 +21,8 @@ import org.teavm.codegen.SourceWriter;
import org.teavm.dependency.DependencyAgent;
import org.teavm.dependency.DependencyPlugin;
import org.teavm.dependency.MethodDependency;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.CallLocation;
import org.teavm.model.MethodReference;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/logging/LoggerNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/logging/LoggerNativeGenerator.java
index 0259c4893..7657adfac 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/logging/LoggerNativeGenerator.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/logging/LoggerNativeGenerator.java
@@ -17,8 +17,8 @@ package org.teavm.classlib.java.util.logging;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.MethodReference;
/**
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/logging/TLogger.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/logging/TLogger.java
index 60cd62901..1f42153a8 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/logging/TLogger.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/logging/TLogger.java
@@ -18,7 +18,7 @@ package org.teavm.classlib.java.util.logging;
import org.teavm.classlib.java.lang.*;
import org.teavm.classlib.java.util.THashMap;
import org.teavm.classlib.java.util.TMap;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
diff --git a/teavm-core/src/main/java/org/teavm/dependency/DependencyPlugin.java b/teavm-core/src/main/java/org/teavm/dependency/DependencyPlugin.java
index 63d44035d..8061ceb58 100644
--- a/teavm-core/src/main/java/org/teavm/dependency/DependencyPlugin.java
+++ b/teavm-core/src/main/java/org/teavm/dependency/DependencyPlugin.java
@@ -22,5 +22,5 @@ import org.teavm.model.CallLocation;
* @author Alexey Andreev
*/
public interface DependencyPlugin {
- void methodAchieved(DependencyAgent checker, MethodDependency method, CallLocation location);
+ void methodAchieved(DependencyAgent agent, MethodDependency method, CallLocation location);
}
diff --git a/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java b/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java
index 477eccc0f..e74a06ea6 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java
@@ -18,10 +18,10 @@ package org.teavm.javascript;
import java.util.*;
import org.teavm.common.*;
import org.teavm.javascript.ast.*;
-import org.teavm.javascript.ni.GeneratedBy;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.InjectedBy;
-import org.teavm.javascript.ni.PreserveOriginalName;
+import org.teavm.javascript.spi.GeneratedBy;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.InjectedBy;
+import org.teavm.javascript.spi.PreserveOriginalName;
import org.teavm.model.*;
import org.teavm.model.util.AsyncProgramSplitter;
import org.teavm.model.util.ProgramUtils;
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 04bfce9d2..b4074040c 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/Renderer.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/Renderer.java
@@ -27,10 +27,10 @@ import org.teavm.debugging.information.DebugInformationEmitter;
import org.teavm.debugging.information.DeferredCallSite;
import org.teavm.debugging.information.DummyDebugInformationEmitter;
import org.teavm.javascript.ast.*;
-import org.teavm.javascript.ni.GeneratorContext;
-import org.teavm.javascript.ni.InjectedBy;
-import org.teavm.javascript.ni.Injector;
-import org.teavm.javascript.ni.InjectorContext;
+import org.teavm.javascript.spi.GeneratorContext;
+import org.teavm.javascript.spi.InjectedBy;
+import org.teavm.javascript.spi.Injector;
+import org.teavm.javascript.spi.InjectorContext;
import org.teavm.model.*;
/**
@@ -53,6 +53,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
private Deque locationStack = new ArrayDeque<>();
private DeferredCallSite lastCallSite;
private DeferredCallSite prevCallSite;
+ private Set asyncMethods;
private boolean async;
private static class InjectorHolder {
@@ -76,12 +77,13 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
}
public Renderer(SourceWriter writer, ListableClassHolderSource classSource, ClassLoader classLoader,
- ServiceRepository services) {
+ ServiceRepository services, Set asyncMethods) {
this.naming = writer.getNaming();
this.writer = writer;
this.classSource = classSource;
this.classLoader = classLoader;
this.services = services;
+ this.asyncMethods = new HashSet<>(asyncMethods);
}
@Override
@@ -695,6 +697,11 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
return async;
}
+ @Override
+ public boolean isAsync(MethodReference method) {
+ return asyncMethods.contains(method);
+ }
+
@Override
public String getCompleteContinuation() {
return "$return";
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ast/NativeMethodNode.java b/teavm-core/src/main/java/org/teavm/javascript/ast/NativeMethodNode.java
index a58ea263e..921d68919 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ast/NativeMethodNode.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/ast/NativeMethodNode.java
@@ -15,7 +15,7 @@
*/
package org.teavm.javascript.ast;
-import org.teavm.javascript.ni.Generator;
+import org.teavm.javascript.spi.Generator;
import org.teavm.model.MethodReference;
/**
diff --git a/teavm-core/src/main/java/org/teavm/runtime/Async.java b/teavm-core/src/main/java/org/teavm/javascript/spi/Async.java
similarity index 96%
rename from teavm-core/src/main/java/org/teavm/runtime/Async.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/Async.java
index 46047cd78..f20ed7d25 100644
--- a/teavm-core/src/main/java/org/teavm/runtime/Async.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/Async.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.runtime;
+package org.teavm.javascript.spi;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ni/GeneratedBy.java b/teavm-core/src/main/java/org/teavm/javascript/spi/GeneratedBy.java
similarity index 96%
rename from teavm-core/src/main/java/org/teavm/javascript/ni/GeneratedBy.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/GeneratedBy.java
index 82d95518b..b74ff7575 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ni/GeneratedBy.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/GeneratedBy.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.javascript.ni;
+package org.teavm.javascript.spi;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ni/Generator.java b/teavm-core/src/main/java/org/teavm/javascript/spi/Generator.java
similarity index 96%
rename from teavm-core/src/main/java/org/teavm/javascript/ni/Generator.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/Generator.java
index 41abd3cff..973491215 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ni/Generator.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/Generator.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.javascript.ni;
+package org.teavm.javascript.spi;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ni/GeneratorContext.java b/teavm-core/src/main/java/org/teavm/javascript/spi/GeneratorContext.java
similarity index 90%
rename from teavm-core/src/main/java/org/teavm/javascript/ni/GeneratorContext.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/GeneratorContext.java
index 047d67c0c..f60b8b08f 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ni/GeneratorContext.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/GeneratorContext.java
@@ -13,11 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.javascript.ni;
+package org.teavm.javascript.spi;
import java.util.Properties;
import org.teavm.common.ServiceRepository;
import org.teavm.model.ListableClassReaderSource;
+import org.teavm.model.MethodReference;
/**
*
@@ -35,4 +36,6 @@ public interface GeneratorContext extends ServiceRepository {
boolean isAsync();
String getCompleteContinuation();
+
+ boolean isAsync(MethodReference method);
}
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ni/InjectedBy.java b/teavm-core/src/main/java/org/teavm/javascript/spi/InjectedBy.java
similarity index 96%
rename from teavm-core/src/main/java/org/teavm/javascript/ni/InjectedBy.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/InjectedBy.java
index 0398b043b..992262986 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ni/InjectedBy.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/InjectedBy.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.javascript.ni;
+package org.teavm.javascript.spi;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ni/Injector.java b/teavm-core/src/main/java/org/teavm/javascript/spi/Injector.java
similarity index 96%
rename from teavm-core/src/main/java/org/teavm/javascript/ni/Injector.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/Injector.java
index d67c483fd..8e3ea2cb8 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ni/Injector.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/Injector.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.javascript.ni;
+package org.teavm.javascript.spi;
import java.io.IOException;
import org.teavm.model.MethodReference;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ni/InjectorContext.java b/teavm-core/src/main/java/org/teavm/javascript/spi/InjectorContext.java
similarity index 97%
rename from teavm-core/src/main/java/org/teavm/javascript/ni/InjectorContext.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/InjectorContext.java
index 71db4a2e9..730c1415c 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ni/InjectorContext.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/InjectorContext.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.javascript.ni;
+package org.teavm.javascript.spi;
import java.io.IOException;
import java.util.Properties;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ni/PreserveOriginalName.java b/teavm-core/src/main/java/org/teavm/javascript/spi/PreserveOriginalName.java
similarity index 96%
rename from teavm-core/src/main/java/org/teavm/javascript/ni/PreserveOriginalName.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/PreserveOriginalName.java
index dcc53a109..272affd09 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ni/PreserveOriginalName.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/PreserveOriginalName.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.javascript.ni;
+package org.teavm.javascript.spi;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ni/Remove.java b/teavm-core/src/main/java/org/teavm/javascript/spi/Remove.java
similarity index 96%
rename from teavm-core/src/main/java/org/teavm/javascript/ni/Remove.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/Remove.java
index 9667f9107..723732d88 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ni/Remove.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/Remove.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.javascript.ni;
+package org.teavm.javascript.spi;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ni/Rename.java b/teavm-core/src/main/java/org/teavm/javascript/spi/Rename.java
similarity index 96%
rename from teavm-core/src/main/java/org/teavm/javascript/ni/Rename.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/Rename.java
index 054c10336..e828610ae 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ni/Rename.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/Rename.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.javascript.ni;
+package org.teavm.javascript.spi;
import java.lang.annotation.*;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ni/Superclass.java b/teavm-core/src/main/java/org/teavm/javascript/spi/Superclass.java
similarity index 96%
rename from teavm-core/src/main/java/org/teavm/javascript/ni/Superclass.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/Superclass.java
index 3da48b787..8c9b03305 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ni/Superclass.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/Superclass.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.javascript.ni;
+package org.teavm.javascript.spi;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/teavm-core/src/main/java/org/teavm/runtime/Sync.java b/teavm-core/src/main/java/org/teavm/javascript/spi/Sync.java
similarity index 96%
rename from teavm-core/src/main/java/org/teavm/runtime/Sync.java
rename to teavm-core/src/main/java/org/teavm/javascript/spi/Sync.java
index 8b5a68c2a..d43b1acf4 100644
--- a/teavm-core/src/main/java/org/teavm/runtime/Sync.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/spi/Sync.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.runtime;
+package org.teavm.javascript.spi;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java b/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java
index abfd73398..75dbb481b 100644
--- a/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java
+++ b/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java
@@ -21,10 +21,10 @@ import org.teavm.callgraph.CallGraph;
import org.teavm.callgraph.CallGraphNode;
import org.teavm.callgraph.CallSite;
import org.teavm.diagnostics.Diagnostics;
-import org.teavm.javascript.ni.InjectedBy;
+import org.teavm.javascript.spi.Async;
+import org.teavm.javascript.spi.InjectedBy;
+import org.teavm.javascript.spi.Sync;
import org.teavm.model.*;
-import org.teavm.runtime.Async;
-import org.teavm.runtime.Sync;
/**
*
diff --git a/teavm-core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java b/teavm-core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java
index 939f2601c..f88d06333 100644
--- a/teavm-core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java
+++ b/teavm-core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java
@@ -17,9 +17,9 @@ package org.teavm.parsing;
import java.util.Map;
import org.teavm.common.Mapper;
-import org.teavm.javascript.ni.Remove;
-import org.teavm.javascript.ni.Rename;
-import org.teavm.javascript.ni.Superclass;
+import org.teavm.javascript.spi.Remove;
+import org.teavm.javascript.spi.Rename;
+import org.teavm.javascript.spi.Superclass;
import org.teavm.model.*;
import org.teavm.model.instructions.*;
import org.teavm.model.util.ModelUtils;
diff --git a/teavm-core/src/main/java/org/teavm/vm/TeaVM.java b/teavm-core/src/main/java/org/teavm/vm/TeaVM.java
index d7ae3665e..9c5815800 100644
--- a/teavm-core/src/main/java/org/teavm/vm/TeaVM.java
+++ b/teavm-core/src/main/java/org/teavm/vm/TeaVM.java
@@ -26,10 +26,10 @@ import org.teavm.diagnostics.AccumulationDiagnostics;
import org.teavm.diagnostics.ProblemProvider;
import org.teavm.javascript.*;
import org.teavm.javascript.ast.ClassNode;
-import org.teavm.javascript.ni.GeneratedBy;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.InjectedBy;
-import org.teavm.javascript.ni.Injector;
+import org.teavm.javascript.spi.GeneratedBy;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.InjectedBy;
+import org.teavm.javascript.spi.Injector;
import org.teavm.model.*;
import org.teavm.model.instructions.*;
import org.teavm.model.util.*;
@@ -396,7 +396,7 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
SourceWriterBuilder builder = new SourceWriterBuilder(naming);
builder.setMinified(minifying);
SourceWriter sourceWriter = builder.build(writer);
- Renderer renderer = new Renderer(sourceWriter, classSet, classLoader, this);
+ Renderer renderer = new Renderer(sourceWriter, classSet, classLoader, this, asyncMethods);
renderer.setProperties(properties);
if (debugEmitter != null) {
int classIndex = 0;
diff --git a/teavm-core/src/main/java/org/teavm/vm/spi/TeaVMHost.java b/teavm-core/src/main/java/org/teavm/vm/spi/TeaVMHost.java
index 59a38ab52..10a8e6c15 100644
--- a/teavm-core/src/main/java/org/teavm/vm/spi/TeaVMHost.java
+++ b/teavm-core/src/main/java/org/teavm/vm/spi/TeaVMHost.java
@@ -17,8 +17,8 @@ package org.teavm.vm.spi;
import java.util.Properties;
import org.teavm.dependency.DependencyListener;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.Injector;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.Injector;
import org.teavm.model.ClassHolderTransformer;
import org.teavm.model.MethodReference;
import org.teavm.vm.TeaVM;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/browser/Window.java b/teavm-dom/src/main/java/org/teavm/dom/browser/Window.java
index ab8263a11..93b28b8a9 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/browser/Window.java
+++ b/teavm-dom/src/main/java/org/teavm/dom/browser/Window.java
@@ -29,7 +29,7 @@ import org.teavm.jso.JSProperty;
*
* @author Alexey Andreev
*/
-public interface Window extends JSGlobal, EventTarget, StorageProvider {
+public interface Window extends JSGlobal, EventTarget, StorageProvider, TypedArrayFactory {
@JSProperty
HTMLDocument getDocument();
@@ -42,10 +42,14 @@ public interface Window extends JSGlobal, EventTarget, StorageProvider {
int setTimeout(TimerHandler handler, int delay);
+ int setTimeout(TimerHandler handler, double delay);
+
void clearTimeout(int timeoutId);
int setInterval(TimerHandler handler, int delay);
+ int setInterval(TimerHandler handler, double delay);
+
void clearInterval(int timeoutId);
@JSProperty("JSON")
@@ -53,79 +57,4 @@ public interface Window extends JSGlobal, EventTarget, StorageProvider {
@JSConstructor("XMLHttpRequest")
XMLHttpRequest createXMLHttpRequest();
-
- @JSConstructor("ArrayBuffer")
- ArrayBuffer createArrayBuffer(int length);
-
- @JSConstructor("Int8Array")
- Int8Array createInt8Array(int length);
-
- @JSConstructor("Int8Array")
- Int8Array createInt8Array(ArrayBuffer buffer);
-
- @JSConstructor("Int8Array")
- Int8Array createInt8Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Uint8Array")
- Uint8Array createUint8Array(int length);
-
- @JSConstructor("Uint8Array")
- Uint8Array createUint8Array(ArrayBuffer buffer);
-
- @JSConstructor("Uint8Array")
- Uint8Array createUint8Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Uint8ClampedArray")
- Uint8ClampedArray createUint8ClampedArray(int length);
-
- @JSConstructor("Uint8ClampedArray")
- Uint8ClampedArray createUint8ClampedArray(ArrayBuffer buffer);
-
- @JSConstructor("Uint8ClampedArray")
- Uint8ClampedArray createUintClamped8Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Int16Array")
- Int16Array createInt16Array(int length);
-
- @JSConstructor("Int16Array")
- Int16Array createInt16Array(ArrayBuffer buffer);
-
- @JSConstructor("Int16Array")
- Int16Array createInt16Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Uint16Array")
- Uint16Array createUint16Array(int length);
-
- @JSConstructor("Uint16Array")
- Uint16Array createUint16Array(ArrayBuffer buffer);
-
- @JSConstructor("Uint16Array")
- Uint16Array createUint16Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Int32Array")
- Int32Array createInt32Array(int length);
-
- @JSConstructor("Int32Array")
- Int32Array createInt32Array(ArrayBuffer buffer);
-
- @JSConstructor("Int32Array")
- Int32Array createInt32Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Float32Array")
- Float32Array createFloat32Array(int length);
-
- @JSConstructor("Float32Array")
- Float32Array createFloat32Array(ArrayBuffer buffer);
-
- @JSConstructor("Float32Array")
- Float32Array createFloat32Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Float64Array")
- Float64Array createFloat64Array(int length);
-
- @JSConstructor("Float64Array")
- Float64Array createFloat64Array(ArrayBuffer buffer);
-
- @JSConstructor("Float64Array")
- Float64Array createFloat64Array(ArrayBuffer buffer, int offset, int length);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/TypedArrayFactory.java b/teavm-dom/src/main/java/org/teavm/dom/typedarrays/TypedArrayFactory.java
new file mode 100644
index 000000000..33086480e
--- /dev/null
+++ b/teavm-dom/src/main/java/org/teavm/dom/typedarrays/TypedArrayFactory.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2015 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.dom.typedarrays;
+
+import org.teavm.jso.JSConstructor;
+import org.teavm.jso.JSObject;
+
+/**
+ *
+ * @author Alexey Andreev
+ */
+public interface TypedArrayFactory extends JSObject {
+ @JSConstructor("ArrayBuffer")
+ ArrayBuffer createArrayBuffer(int length);
+
+ @JSConstructor("Int8Array")
+ Int8Array createInt8Array(int length);
+
+ @JSConstructor("Int8Array")
+ Int8Array createInt8Array(ArrayBuffer buffer);
+
+ @JSConstructor("Int8Array")
+ Int8Array createInt8Array(ArrayBuffer buffer, int offset, int length);
+
+ @JSConstructor("Uint8Array")
+ Uint8Array createUint8Array(int length);
+
+ @JSConstructor("Uint8Array")
+ Uint8Array createUint8Array(ArrayBuffer buffer);
+
+ @JSConstructor("Uint8Array")
+ Uint8Array createUint8Array(ArrayBuffer buffer, int offset, int length);
+
+ @JSConstructor("Uint8ClampedArray")
+ Uint8ClampedArray createUint8ClampedArray(int length);
+
+ @JSConstructor("Uint8ClampedArray")
+ Uint8ClampedArray createUint8ClampedArray(ArrayBuffer buffer);
+
+ @JSConstructor("Uint8ClampedArray")
+ Uint8ClampedArray createUintClamped8Array(ArrayBuffer buffer, int offset, int length);
+
+ @JSConstructor("Int16Array")
+ Int16Array createInt16Array(int length);
+
+ @JSConstructor("Int16Array")
+ Int16Array createInt16Array(ArrayBuffer buffer);
+
+ @JSConstructor("Int16Array")
+ Int16Array createInt16Array(ArrayBuffer buffer, int offset, int length);
+
+ @JSConstructor("Uint16Array")
+ Uint16Array createUint16Array(int length);
+
+ @JSConstructor("Uint16Array")
+ Uint16Array createUint16Array(ArrayBuffer buffer);
+
+ @JSConstructor("Uint16Array")
+ Uint16Array createUint16Array(ArrayBuffer buffer, int offset, int length);
+
+ @JSConstructor("Int32Array")
+ Int32Array createInt32Array(int length);
+
+ @JSConstructor("Int32Array")
+ Int32Array createInt32Array(ArrayBuffer buffer);
+
+ @JSConstructor("Int32Array")
+ Int32Array createInt32Array(ArrayBuffer buffer, int offset, int length);
+
+ @JSConstructor("Float32Array")
+ Float32Array createFloat32Array(int length);
+
+ @JSConstructor("Float32Array")
+ Float32Array createFloat32Array(ArrayBuffer buffer);
+
+ @JSConstructor("Float32Array")
+ Float32Array createFloat32Array(ArrayBuffer buffer, int offset, int length);
+
+ @JSConstructor("Float64Array")
+ Float64Array createFloat64Array(int length);
+
+ @JSConstructor("Float64Array")
+ Float64Array createFloat64Array(ArrayBuffer buffer);
+
+ @JSConstructor("Float64Array")
+ Float64Array createFloat64Array(ArrayBuffer buffer, int offset, int length);
+}
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 12e1222b0..75f46c9ae 100644
--- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyGenerator.java
+++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyGenerator.java
@@ -21,8 +21,8 @@ import net.java.html.js.JavaScriptBody;
import org.teavm.codegen.NamingStrategy;
import org.teavm.codegen.SourceWriter;
import org.teavm.javascript.Renderer;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.*;
/**
diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyTransformer.java b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyTransformer.java
index 6cadd5a07..b92d0afdb 100644
--- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyTransformer.java
+++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyTransformer.java
@@ -17,7 +17,7 @@ package org.teavm.html4j;
import net.java.html.js.JavaScriptBody;
import org.teavm.diagnostics.Diagnostics;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
import org.teavm.model.*;
/**
diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConv.java b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConv.java
index 9d7b41127..8183887cb 100644
--- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConv.java
+++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConv.java
@@ -15,7 +15,7 @@
*/
package org.teavm.html4j;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
/**
*
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 5a9743509..a26227dd0 100644
--- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConvGenerator.java
+++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConvGenerator.java
@@ -17,8 +17,8 @@ package org.teavm.html4j;
import java.io.IOException;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.*;
/**
diff --git a/teavm-jso/pom.xml b/teavm-jso/pom.xml
index a42c91397..8b70a0006 100644
--- a/teavm-jso/pom.xml
+++ b/teavm-jso/pom.xml
@@ -43,42 +43,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
-
- org.teavm
- teavm-maven-plugin
- ${project.version}
-
-
- org.teavm
- teavm-classlib
- ${project.version}
-
-
-
-
- generate-javascript-tests
-
- build-test-javascript
-
- process-test-classes
-
- false
-
- en, en_US, en_GB, ru, ru_RU
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- **
-
-
-
org.apache.maven.plugins
maven-checkstyle-plugin
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JS.java b/teavm-jso/src/main/java/org/teavm/jso/JS.java
index 0481c80e2..19eaa7d1c 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JS.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/JS.java
@@ -17,7 +17,7 @@ package org.teavm.jso;
import java.util.Iterator;
import org.teavm.dependency.PluggableDependency;
-import org.teavm.javascript.ni.InjectedBy;
+import org.teavm.javascript.spi.InjectedBy;
import org.teavm.jso.plugin.JSNativeGenerator;
/**
@@ -101,6 +101,9 @@ public final class JS {
@InjectedBy(JSNativeGenerator.class)
public static native JSObject wrap(short num);
+ @InjectedBy(JSNativeGenerator.class)
+ public static native JSObject pass(Object obj);
+
public static JSArray wrap(T[] array) {
JSArray result = createArray(array.length);
for (int i = 0; i < array.length; ++i) {
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSBodyGenerator.java b/teavm-jso/src/main/java/org/teavm/jso/plugin/JSBodyGenerator.java
index 25bbb4092..f2c7ed50c 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSBodyGenerator.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/plugin/JSBodyGenerator.java
@@ -18,8 +18,8 @@ package org.teavm.jso.plugin;
import java.io.IOException;
import java.util.List;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.*;
/**
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java b/teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
index 856aa0dc9..16792fe25 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
@@ -21,8 +21,8 @@ import org.teavm.dependency.*;
import org.teavm.javascript.ast.ConstantExpr;
import org.teavm.javascript.ast.Expr;
import org.teavm.javascript.ast.InvocationExpr;
-import org.teavm.javascript.ni.Injector;
-import org.teavm.javascript.ni.InjectorContext;
+import org.teavm.javascript.spi.Injector;
+import org.teavm.javascript.spi.InjectorContext;
import org.teavm.jso.JS;
import org.teavm.model.CallLocation;
import org.teavm.model.ClassReader;
@@ -88,6 +88,9 @@ public class JSNativeGenerator implements Injector, DependencyPlugin {
}
writer.append("))");
break;
+ case "pass":
+ context.writeExpr(context.getArgument(0));
+ break;
case "wrap":
if (methodRef.getDescriptor().parameterType(0).isObject("java.lang.String")) {
writer.append("$rt_ustr(");
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java b/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
index b2d44ab55..af8872317 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
@@ -17,8 +17,8 @@ package org.teavm.jso.plugin;
import java.util.*;
import org.teavm.diagnostics.Diagnostics;
-import org.teavm.javascript.ni.GeneratedBy;
-import org.teavm.javascript.ni.PreserveOriginalName;
+import org.teavm.javascript.spi.GeneratedBy;
+import org.teavm.javascript.spi.PreserveOriginalName;
import org.teavm.jso.*;
import org.teavm.model.*;
import org.teavm.model.instructions.*;
diff --git a/teavm-core/src/main/java/org/teavm/runtime/AsyncCallback.java b/teavm-platform/src/main/java/org/teavm/platform/async/AsyncCallback.java
similarity index 82%
rename from teavm-core/src/main/java/org/teavm/runtime/AsyncCallback.java
rename to teavm-platform/src/main/java/org/teavm/platform/async/AsyncCallback.java
index 8579eab71..675bacd19 100644
--- a/teavm-core/src/main/java/org/teavm/runtime/AsyncCallback.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/async/AsyncCallback.java
@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.runtime;
+package org.teavm.platform.async;
/**
*
- * @author Alexey Andreev
+ * @author Alexey Andreev
*/
public interface AsyncCallback {
- void complete(T value);
+ void complete(T result);
- void error(Exception e);
+ void error(Throwable e);
}
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodGenerator.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodGenerator.java
new file mode 100644
index 000000000..2dfbc2878
--- /dev/null
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodGenerator.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2015 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.platform.plugin;
+
+import java.io.IOException;
+import org.teavm.codegen.SourceWriter;
+import org.teavm.dependency.DependencyAgent;
+import org.teavm.dependency.DependencyPlugin;
+import org.teavm.dependency.MethodDependency;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
+import org.teavm.model.*;
+import org.teavm.platform.async.AsyncCallback;
+
+/**
+ *
+ * @author Alexey Andreev
+ */
+public class AsyncMethodGenerator implements Generator, DependencyPlugin {
+ private static final MethodReference completeMethod = new MethodReference(AsyncCallback.class, "complete",
+ Object.class, void.class);
+ private static final MethodReference errorMethod = new MethodReference(AsyncCallback.class, "error",
+ Throwable.class, void.class);
+
+ @Override
+ public void generate(GeneratorContext context, SourceWriter writer, MethodReference methodRef) throws IOException {
+ MethodReference asyncRef = getAsyncReference(methodRef);
+ writer.append("var callback").ws().append("=").ws().append("function()").ws().append("{}").softNewLine();
+ writer.append("callback.").appendMethod(completeMethod).ws().append("=").ws().append("function($this,").ws()
+ .append("val)").ws().append("{").indent().softNewLine();
+ writer.append("return $return($rt_asyncResult(val));").softNewLine();
+ writer.outdent().append("};").softNewLine();
+ writer.append("callback.").appendMethod(errorMethod).ws().append("=").ws().append("function($this,").ws()
+ .append("e)").ws().append("{").indent().softNewLine();
+ writer.append("return $return($rt_asyncError(e));").softNewLine();
+ writer.outdent().append("};").softNewLine();
+ writer.append("try").ws().append("{").indent().softNewLine();
+ writer.append("return ").appendMethodBody(asyncRef).append('(');
+ ClassReader cls = context.getClassSource().get(methodRef.getClassName());
+ MethodReader method = cls.getMethod(methodRef.getDescriptor());
+ int start = method.hasModifier(ElementModifier.STATIC) ? 1 : 0;
+ for (int i = start; i <= methodRef.parameterCount(); ++i) {
+ writer.append(context.getParameterName(i));
+ writer.append(',').ws();
+ }
+ writer.append("callback);").softNewLine();
+ writer.outdent().append("}").ws().append("catch($e)").ws().append("{").indent().softNewLine();
+ writer.append("return $return($rt_asyncError($e));").softNewLine();
+ writer.outdent().append("}").softNewLine();
+ }
+
+ private MethodReference getAsyncReference(MethodReference methodRef) {
+ ValueType[] signature = new ValueType[methodRef.parameterCount() + 2];
+ for (int i = 0; i < methodRef.parameterCount(); ++i) {
+ signature[i] = methodRef.getDescriptor().parameterType(i);
+ }
+ signature[methodRef.parameterCount()] = ValueType.parse(AsyncCallback.class);
+ signature[methodRef.parameterCount() + 1] = ValueType.VOID;
+ return new MethodReference(methodRef.getClassName(), methodRef.getName(), signature);
+ }
+
+ @Override
+ public void methodAchieved(DependencyAgent checker, MethodDependency method, CallLocation location) {
+ MethodReference asyncRef = getAsyncReference(method.getReference());
+ MethodDependency asyncMethod = checker.linkMethod(asyncRef, location);
+ int paramCount = method.getReference().parameterCount();
+ for (int i = 0; i <= paramCount; ++i) {
+ method.getVariable(i).connect(asyncMethod.getVariable(i));
+ }
+ asyncMethod.use();
+ }
+}
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodProcessor.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodProcessor.java
new file mode 100644
index 000000000..9bc0b6564
--- /dev/null
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodProcessor.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2015 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.platform.plugin;
+
+import org.teavm.dependency.PluggableDependency;
+import org.teavm.diagnostics.Diagnostics;
+import org.teavm.javascript.spi.Async;
+import org.teavm.javascript.spi.GeneratedBy;
+import org.teavm.model.*;
+import org.teavm.platform.async.AsyncCallback;
+
+/**
+ *
+ * @author Alexey Andreev
+ */
+public class AsyncMethodProcessor implements ClassHolderTransformer {
+ @Override
+ public void transformClass(ClassHolder cls, ClassReaderSource innerSource, Diagnostics diagnostics) {
+ for (MethodHolder method : cls.getMethods()) {
+ if (method.hasModifier(ElementModifier.NATIVE) &&
+ method.getAnnotations().get(Async.class.getName()) != null &&
+ method.getAnnotations().get(GeneratedBy.class.getName()) == null) {
+ ValueType[] signature = new ValueType[method.parameterCount() + 2];
+ for (int i = 0; i < method.parameterCount(); ++i) {
+ signature[i] = method.parameterType(i);
+ }
+ signature[method.parameterCount()] = ValueType.parse(AsyncCallback.class);
+ signature[method.parameterCount() + 1] = ValueType.VOID;
+ MethodDescriptor asyncDesc = new MethodDescriptor(method.getName(), signature);
+ MethodHolder asyncMethod = cls.getMethod(asyncDesc);
+ if (asyncMethod != null) {
+ if (asyncMethod.hasModifier(ElementModifier.STATIC) !=
+ method.hasModifier(ElementModifier.STATIC)) {
+ diagnostics.error(new CallLocation(method.getReference()), "Methods {{m0}} and {{m1}} must " +
+ "both be either static or non-static",
+ method.getReference(), asyncMethod.getReference());
+ }
+ AnnotationHolder annot = new AnnotationHolder(GeneratedBy.class.getName());
+ annot.getValues().put("value", new AnnotationValue(ValueType.parse(AsyncMethodGenerator.class)));
+ method.getAnnotations().add(annot);
+ annot = new AnnotationHolder(PluggableDependency.class.getName());
+ annot.getValues().put("value", new AnnotationValue(ValueType.parse(AsyncMethodGenerator.class)));
+ method.getAnnotations().add(annot);
+ }
+ }
+ }
+ }
+}
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderNativeGenerator.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderNativeGenerator.java
index 6ddda44ca..5fe2d9204 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderNativeGenerator.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderNativeGenerator.java
@@ -19,8 +19,8 @@ import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import org.teavm.codegen.SourceWriter;
-import org.teavm.javascript.ni.Generator;
-import org.teavm.javascript.ni.GeneratorContext;
+import org.teavm.javascript.spi.Generator;
+import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.model.*;
import org.teavm.platform.metadata.MetadataGenerator;
import org.teavm.platform.metadata.MetadataProvider;
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderTransformer.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderTransformer.java
index 3ad502b9e..b2183357a 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderTransformer.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderTransformer.java
@@ -16,7 +16,7 @@
package org.teavm.platform.plugin;
import org.teavm.diagnostics.Diagnostics;
-import org.teavm.javascript.ni.GeneratedBy;
+import org.teavm.javascript.spi.GeneratedBy;
import org.teavm.model.*;
import org.teavm.platform.metadata.MetadataProvider;
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/PlatformPlugin.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/PlatformPlugin.java
index ad16bfc25..5c3a34bd4 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/PlatformPlugin.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/PlatformPlugin.java
@@ -29,5 +29,6 @@ public class PlatformPlugin implements TeaVMPlugin {
host.add(new ResourceTransformer());
host.add(new ResourceAccessorTransformer(host));
host.add(new ResourceAccessorDependencyListener());
+ host.add(new AsyncMethodProcessor());
}
}
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceAccessorGenerator.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceAccessorGenerator.java
index 62c267ad5..18337035c 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceAccessorGenerator.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceAccessorGenerator.java
@@ -18,8 +18,8 @@ package org.teavm.platform.plugin;
import java.io.IOException;
import org.teavm.javascript.ast.ConstantExpr;
import org.teavm.javascript.ast.Expr;
-import org.teavm.javascript.ni.Injector;
-import org.teavm.javascript.ni.InjectorContext;
+import org.teavm.javascript.spi.Injector;
+import org.teavm.javascript.spi.InjectorContext;
import org.teavm.model.MethodReference;
import org.teavm.model.ValueType;
diff --git a/teavm-tests/.gitignore b/teavm-tests/.gitignore
new file mode 100644
index 000000000..c708c363d
--- /dev/null
+++ b/teavm-tests/.gitignore
@@ -0,0 +1,4 @@
+/target
+/.settings
+/.classpath
+/.project
diff --git a/teavm-tests/pom.xml b/teavm-tests/pom.xml
new file mode 100644
index 000000000..806173c02
--- /dev/null
+++ b/teavm-tests/pom.xml
@@ -0,0 +1,115 @@
+
+
+ 4.0.0
+
+
+ org.teavm
+ teavm
+ 0.3.0-SNAPSHOT
+
+ teavm-tests
+
+ TeaVM tests
+ Project containing TeaVM tests, as it is impossible to test each module separately
+
+
+
+ org.teavm
+ teavm-core
+ ${project.version}
+
+
+ org.teavm
+ teavm-classlib
+ ${project.version}
+
+
+ org.teavm
+ teavm-platform
+ ${project.version}
+
+
+ org.teavm
+ teavm-jso
+ ${project.version}
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+
+ org.teavm
+ teavm-maven-plugin
+ ${project.version}
+
+
+ org.teavm
+ teavm-platform
+ ${project.version}
+
+
+
+
+ generate-javascript-tests
+
+ build-test-javascript
+
+ process-test-classes
+
+ false
+
+ en, en_US, en_GB, ru, ru_RU
+
+ ${teavm.test.incremental}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ org/teavm/platform/**/*.java
+ org/teavm/jso/**/*.java
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+ ../checkstyle.xml
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
+
\ No newline at end of file
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/io/BufferedInputStreamTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/io/BufferedInputStreamTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/io/BufferedInputStreamTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/io/BufferedInputStreamTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/io/BufferedReaderTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/io/BufferedReaderTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/io/BufferedReaderTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/io/BufferedReaderTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/io/InputStreamReaderTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/io/InputStreamReaderTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/io/InputStreamReaderTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/io/InputStreamReaderTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/io/PushbackInputStreamTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/io/PushbackInputStreamTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/io/PushbackInputStreamTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/io/PushbackInputStreamTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/BooleanTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/BooleanTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/BooleanTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/BooleanTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/CharacterTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/CharacterTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/CharacterTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/CharacterTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/ClassTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/ClassTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/ClassTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/ClassTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/DoubleTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/DoubleTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/DoubleTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/DoubleTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/EnumTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/EnumTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/EnumTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/EnumTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/FloatTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/FloatTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/FloatTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/FloatTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/IntegerTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/IntegerTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/IntegerTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/IntegerTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/MathTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/MathTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/MathTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/MathTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/ObjectTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/ObjectTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/ObjectTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/ObjectTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/StringBuilderTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/StringBuilderTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/StringBuilderTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/StringBuilderTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/StringTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/StringTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/StringTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/StringTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/SystemTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/SystemTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/SystemTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/SystemTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/TestObject.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/TestObject.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/TestObject.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/TestObject.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/ThreadTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/ThreadTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/ThreadTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/ThreadTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/VMTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/VMTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/VMTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/VMTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/reflect/ArrayTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/lang/reflect/ArrayTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/lang/reflect/ArrayTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/lang/reflect/ArrayTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigDecimalArithmeticTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigDecimalArithmeticTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigDecimalArithmeticTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigDecimalArithmeticTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigDecimalCompareTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigDecimalCompareTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigDecimalCompareTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigDecimalCompareTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigDecimalConstructorsTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigDecimalConstructorsTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigDecimalConstructorsTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigDecimalConstructorsTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigDecimalConvertTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigDecimalConvertTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigDecimalConvertTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigDecimalConvertTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigDecimalScaleOperationsTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigDecimalScaleOperationsTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigDecimalScaleOperationsTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigDecimalScaleOperationsTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerAddTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerAddTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerAddTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerAddTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerAndTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerAndTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerAndTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerAndTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerCompareTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerCompareTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerCompareTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerCompareTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerConstructorsTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerConstructorsTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerConstructorsTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerConstructorsTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerConvertTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerConvertTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerConvertTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerConvertTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerDivideTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerDivideTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerDivideTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerDivideTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerHashCodeTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerHashCodeTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerHashCodeTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerHashCodeTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerModPowTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerModPowTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerModPowTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerModPowTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerMultiplyTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerMultiplyTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerMultiplyTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerMultiplyTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerNotTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerNotTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerNotTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerNotTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerOperateBitsTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerOperateBitsTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerOperateBitsTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerOperateBitsTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerOrTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerOrTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerOrTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerOrTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerSubtractTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerSubtractTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerSubtractTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerSubtractTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerToStringTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerToStringTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerToStringTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerToStringTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerXorTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerXorTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/math/BigIntegerXorTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/math/BigIntegerXorTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/nio/ByteBufferTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/nio/ByteBufferTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/nio/ByteBufferTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/nio/ByteBufferTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/nio/ByteBufferWrapperTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/nio/ByteBufferWrapperTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/nio/ByteBufferWrapperTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/nio/ByteBufferWrapperTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/nio/CharBufferTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/nio/CharBufferTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/nio/CharBufferTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/nio/CharBufferTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/nio/DoubleBufferTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/nio/DoubleBufferTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/nio/DoubleBufferTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/nio/DoubleBufferTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/nio/FloatBufferTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/nio/FloatBufferTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/nio/FloatBufferTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/nio/FloatBufferTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/nio/IntBufferTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/nio/IntBufferTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/nio/IntBufferTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/nio/IntBufferTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/nio/LongBufferTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/nio/LongBufferTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/nio/LongBufferTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/nio/LongBufferTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/nio/ShortBufferTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/nio/ShortBufferTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/nio/ShortBufferTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/nio/ShortBufferTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/text/DateFormatTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/text/DateFormatTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/text/DateFormatTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/text/DateFormatTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/text/SimpleDateFormatTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/text/SimpleDateFormatTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/text/SimpleDateFormatTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/text/SimpleDateFormatTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/ArrayDequeTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/ArrayDequeTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/ArrayDequeTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/ArrayDequeTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/ArrayListTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/ArrayListTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/ArrayListTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/ArrayListTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/ArraysTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/ArraysTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/ArraysTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/ArraysTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/BitSetTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/BitSetTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/BitSetTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/BitSetTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/CollectionsTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/CollectionsTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/CollectionsTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/CollectionsTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/HashtableTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/HashtableTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/HashtableTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/HashtableTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/LinkedHashMapTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/LinkedHashMapTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/LinkedHashMapTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/LinkedHashMapTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/LinkedListTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/LinkedListTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/LinkedListTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/LinkedListTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/LocaleTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/LocaleTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/LocaleTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/LocaleTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/PriorityQueueTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/PriorityQueueTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/PriorityQueueTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/PriorityQueueTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/ServiceLoaderTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/ServiceLoaderTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/ServiceLoaderTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/ServiceLoaderTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/StringTokenizerTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/StringTokenizerTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/StringTokenizerTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/StringTokenizerTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/TestService.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/TestService.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/TestService.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/TestService.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/TestServiceImpl.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/TestServiceImpl.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/TestServiceImpl.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/TestServiceImpl.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/TreeMapTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/TreeMapTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/TreeMapTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/TreeMapTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/VectorTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/VectorTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/VectorTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/VectorTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/Matcher2Test.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/Matcher2Test.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/Matcher2Test.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/Matcher2Test.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/MatcherTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/MatcherTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/MatcherTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/MatcherTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/ModeTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/ModeTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/ModeTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/ModeTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/Pattern2Test.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/Pattern2Test.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/Pattern2Test.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/Pattern2Test.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternErrorTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/PatternErrorTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternErrorTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/PatternErrorTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternSyntaxExceptionTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/PatternSyntaxExceptionTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternSyntaxExceptionTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/PatternSyntaxExceptionTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/PatternTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/PatternTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/ReplaceTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/ReplaceTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/ReplaceTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/ReplaceTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/SplitTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/SplitTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/SplitTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/regex/SplitTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/zip/GZIPInputStreamTest.java b/teavm-tests/src/test/java/org/teavm/classlib/java/util/zip/GZIPInputStreamTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/java/util/zip/GZIPInputStreamTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/java/util/zip/GZIPInputStreamTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/support/Support_CollectionTest.java b/teavm-tests/src/test/java/org/teavm/classlib/support/Support_CollectionTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/support/Support_CollectionTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/support/Support_CollectionTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/support/Support_ListTest.java b/teavm-tests/src/test/java/org/teavm/classlib/support/Support_ListTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/support/Support_ListTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/support/Support_ListTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/support/Support_MapTest2.java b/teavm-tests/src/test/java/org/teavm/classlib/support/Support_MapTest2.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/support/Support_MapTest2.java
rename to teavm-tests/src/test/java/org/teavm/classlib/support/Support_MapTest2.java
diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/support/Support_UnmodifiableCollectionTest.java b/teavm-tests/src/test/java/org/teavm/classlib/support/Support_UnmodifiableCollectionTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/classlib/support/Support_UnmodifiableCollectionTest.java
rename to teavm-tests/src/test/java/org/teavm/classlib/support/Support_UnmodifiableCollectionTest.java
diff --git a/teavm-jso/src/test/java/org/teavm/jso/test/JSOTest.java b/teavm-tests/src/test/java/org/teavm/jso/test/JSOTest.java
similarity index 100%
rename from teavm-jso/src/test/java/org/teavm/jso/test/JSOTest.java
rename to teavm-tests/src/test/java/org/teavm/jso/test/JSOTest.java
diff --git a/teavm-jso/src/test/java/org/teavm/jso/test/RegExp.java b/teavm-tests/src/test/java/org/teavm/jso/test/RegExp.java
similarity index 100%
rename from teavm-jso/src/test/java/org/teavm/jso/test/RegExp.java
rename to teavm-tests/src/test/java/org/teavm/jso/test/RegExp.java
diff --git a/teavm-jso/src/test/java/org/teavm/jso/test/Window.java b/teavm-tests/src/test/java/org/teavm/jso/test/Window.java
similarity index 100%
rename from teavm-jso/src/test/java/org/teavm/jso/test/Window.java
rename to teavm-tests/src/test/java/org/teavm/jso/test/Window.java
diff --git a/teavm-classlib/src/test/java/org/teavm/platform/metadata/DependentTestResource.java b/teavm-tests/src/test/java/org/teavm/platform/metadata/DependentTestResource.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/platform/metadata/DependentTestResource.java
rename to teavm-tests/src/test/java/org/teavm/platform/metadata/DependentTestResource.java
diff --git a/teavm-classlib/src/test/java/org/teavm/platform/metadata/MetadataGeneratorTest.java b/teavm-tests/src/test/java/org/teavm/platform/metadata/MetadataGeneratorTest.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/platform/metadata/MetadataGeneratorTest.java
rename to teavm-tests/src/test/java/org/teavm/platform/metadata/MetadataGeneratorTest.java
diff --git a/teavm-classlib/src/test/java/org/teavm/platform/metadata/TestResource.java b/teavm-tests/src/test/java/org/teavm/platform/metadata/TestResource.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/platform/metadata/TestResource.java
rename to teavm-tests/src/test/java/org/teavm/platform/metadata/TestResource.java
diff --git a/teavm-classlib/src/test/java/org/teavm/platform/metadata/TestResourceGenerator.java b/teavm-tests/src/test/java/org/teavm/platform/metadata/TestResourceGenerator.java
similarity index 100%
rename from teavm-classlib/src/test/java/org/teavm/platform/metadata/TestResourceGenerator.java
rename to teavm-tests/src/test/java/org/teavm/platform/metadata/TestResourceGenerator.java
diff --git a/teavm-classlib/src/test/resources/META-INF/services/org.teavm.classlib.java.util.TestService b/teavm-tests/src/test/resources/META-INF/services/org.teavm.classlib.java.util.TestService
similarity index 100%
rename from teavm-classlib/src/test/resources/META-INF/services/org.teavm.classlib.java.util.TestService
rename to teavm-tests/src/test/resources/META-INF/services/org.teavm.classlib.java.util.TestService