代码之家  ›  专栏  ›  技术社区  ›  quarks

NoSuchMethodError:'无效org.teavm.backend.javascript.JavaScriptTarget.setStrict(布尔值)

  •  0
  • quarks  · 技术社区  · 4 年前

    是什么 NoSuchMethodError: 'void org.teavm.backend.javascript.JavaScriptTarget.setStrict(boolean)

    Running MyGame.Sample.FlatbuffersTest
    Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.453 sec <<< FAILURE!
    test(MyGame.Sample.FlatbuffersTest)  Time elapsed: 0.312 sec  <<< ERROR!
    java.lang.NoSuchMethodError: 'void org.teavm.backend.javascript.JavaScriptTarget.setStrict(boolean)'
        at org.teavm.junit.TeaVMTestRunner.lambda$compileToJs$4(TeaVMTestRunner.java:679)
        at org.teavm.junit.TeaVMTestRunner.compile(TeaVMTestRunner.java:778)
        at org.teavm.junit.TeaVMTestRunner.compileToJs(TeaVMTestRunner.java:710)
        at org.teavm.junit.TeaVMTestRunner.runCompiledTest(TeaVMTestRunner.java:400)
        at org.teavm.junit.TeaVMTestRunner.runChild(TeaVMTestRunner.java:348)
        at org.teavm.junit.TeaVMTestRunner.run(TeaVMTestRunner.java:205)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    

    使用Maven运行单元测试: test -Dteavm.junit.target=target/js-tests -Dteavm.junit.js.runner=htmlunit -Dteavm.junit.js.threads=2 -f pom.xml

    https://github.com/cyberquarks/flatbuffers-demo-teavm/blob/181b4f12a1122e89d3a698cd8b101428dfa14e6e/src/test/java/MyGame/Sample/FlatbuffersTest.java#L30

    0 回复  |  直到 4 年前