diff --git a/metaprogramming/api/src/main/java/org/teavm/metaprogramming/Metaprogramming.java b/metaprogramming/api/src/main/java/org/teavm/metaprogramming/Metaprogramming.java index db7e4ec1d..333f69c29 100644 --- a/metaprogramming/api/src/main/java/org/teavm/metaprogramming/Metaprogramming.java +++ b/metaprogramming/api/src/main/java/org/teavm/metaprogramming/Metaprogramming.java @@ -80,7 +80,8 @@ public final class Metaprogramming { } public static Value proxy(Class type, InvocationHandler handler) { - return proxy(findClass(type), handler); + unsupported(); + return null; } public static Value proxy(ReflectClass type, InvocationHandler handler) { diff --git a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/MetaprogrammingImpl.java b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/MetaprogrammingImpl.java index 577894381..06687160c 100644 --- a/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/MetaprogrammingImpl.java +++ b/metaprogramming/impl/src/main/java/org/teavm/metaprogramming/impl/MetaprogrammingImpl.java @@ -176,11 +176,11 @@ public final class MetaprogrammingImpl { } public static void location(String fileName, int lineNumber) { - unsupported(); + generator.forcedLocation = new TextLocation(fileName, lineNumber); } public static void defaultLocation() { - unsupported(); + generator.forcedLocation = null; } @SuppressWarnings("WeakerAccess") @@ -249,6 +249,7 @@ public final class MetaprogrammingImpl { returnType = methodHolder.getResultType(); varContext = nestedVarContext; generator = new CompositeMethodGenerator(varContext, new Program()); + generator.forcedLocation = generatorBackup.forcedLocation; Program program = generator.program; program.createBasicBlock(); diff --git a/tools/junit/pom.xml b/tools/junit/pom.xml index ba9ff4d51..3fe0b0e0c 100644 --- a/tools/junit/pom.xml +++ b/tools/junit/pom.xml @@ -26,6 +26,8 @@ 4.0.0 teavm-junit + TeaVM JUnit runner + TeaVM implementation of JUnit API diff --git a/tools/junit/src/main/java/org/teavm/junit/HtmlUnitRunStrategy.java b/tools/junit/src/main/java/org/teavm/junit/HtmlUnitRunStrategy.java index dafd8dcf8..bad6ab76a 100644 --- a/tools/junit/src/main/java/org/teavm/junit/HtmlUnitRunStrategy.java +++ b/tools/junit/src/main/java/org/teavm/junit/HtmlUnitRunStrategy.java @@ -52,6 +52,11 @@ class HtmlUnitRunStrategy implements TestRunStrategy { init(); } + try { + page.set(webClient.get().getPage("about:blank")); + } catch (IOException e) { + throw new RuntimeException(e); + } page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), "runtime.js"))); page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), "test.js"))); @@ -75,11 +80,6 @@ class HtmlUnitRunStrategy implements TestRunStrategy { private void init() { webClient.set(new WebClient(BrowserVersion.CHROME)); - try { - page.set(webClient.get().getPage("about:blank")); - } catch (IOException e) { - throw new RuntimeException(e); - } } private String readFile(File file) throws IOException {