Skip to content

Instantly share code, notes, and snippets.

@mdproctor
Created September 18, 2021 02:13
Show Gist options
  • Save mdproctor/4b27ae633b67ee5ad10bde6f4f4f93c2 to your computer and use it in GitHub Desktop.
Save mdproctor/4b27ae633b67ee5ad10bde6f4f4f93c2 to your computer and use it in GitHub Desktop.
@Test
public void testABC() throws IOException {
String a = code("import jsinterop.annotations.JsType;import jsinterop.annotations.JsMethod;import jsinterop.annotations.JsProperty;",
"public class A {",
" public A a = new A();",
" public void foo() {}",
" @JsMethod\n",
" public static native String goodbyeWorld();",
"}");
String a_native_1 = code("A.goodbyeWorld = function() {\n" +
" return \"Goodbye World1\";\n" +
"};");
String b = code("import jsinterop.annotations.JsType;import jsinterop.annotations.JsMethod;import jsinterop.annotations.JsProperty;",
"public class B extends A{",
//" public void foo() {}",
"}");
String c = code("import jsinterop.annotations.JsType;import jsinterop.annotations.JsMethod;import jsinterop.annotations.JsProperty;",
"public class C {",
" public void bar(B b) {" +
" b.foo();",
" }",
"}");
TranspileResult results = Helper.create()
.addJava("A", a)
.addJava("B", b)
.addJava("C", c)
.addNative("A", a_native_1)
.assertTranspileSucceeds();
}
-------
- src
/var/folders/0b/54kqd29n7lq70q_9c9tyl2h40000gn/T/tester8252696094701904295/input/test/A.java
test/A.java
test/A.native_js
- deps
- src
/var/folders/0b/54kqd29n7lq70q_9c9tyl2h40000gn/T/tester8252696094701904295/input/test/B.java
test/B.java
- deps
test/A.java
- src
/var/folders/0b/54kqd29n7lq70q_9c9tyl2h40000gn/T/tester8252696094701904295/input/test/C.java
test/C.java
- deps
test/A.java
test/B.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment