unexpected error invoking equal_dcomp_instrumented

18 views
Skip to first unread message

boyan...@gmail.com

unread,
May 6, 2021, 6:38:45 PM5/6/21
to Daikon discuss
Hi,

I've met the `unexpected error invoking equal_dcomp_instrumented` when I use Daikon to detect invariants against Closure project in defects4j dataset. From the exception stack trace, I think it is the accessible issue related to the instrumented code. Below I paste the detailed stack trace,
java.lang.ExceptionInInitializerError
        at com.google.javascript.jscomp.RhinoErrorReporter.<init>(RhinoErrorReporter.java:77)
        at com.google.javascript.jscomp.RhinoErrorReporter.<init>(RhinoErrorReporter.java:32)
        at com.google.javascript.jscomp.RhinoErrorReporter$OldRhinoErrorReporter.<init>(RhinoErrorReporter.java:144)
        at com.google.javascript.jscomp.RhinoErrorReporter$OldRhinoErrorReporter.<init>(RhinoErrorReporter.java:140)
        at com.google.javascript.jscomp.RhinoErrorReporter.forOldRhino(RhinoErrorReporter.java:109)
        at com.google.javascript.jscomp.Compiler.<init>(Compiler.java:168)
        at com.google.javascript.jscomp.CommandLineRunner.createCompiler(CommandLineRunner.java:815)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.doRun(AbstractCommandLineRunner.java:744)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.run(AbstractCommandLineRunner.java:383)
        at com.google.javascript.jscomp.CommandLineRunnerTest.compile(CommandLineRunnerTest.java:1303)
        at com.google.javascript.jscomp.CommandLineRunnerTest.test(CommandLineRunnerTest.java:1186)
        at com.google.javascript.jscomp.CommandLineRunnerTest.test(CommandLineRunnerTest.java:1175)
        at com.google.javascript.jscomp.CommandLineRunnerTest.testSame(CommandLineRunnerTest.java:1163)
        at com.google.javascript.jscomp.CommandLineRunnerTest.testSame(CommandLineRunnerTest.java:1159)
        at com.google.javascript.jscomp.CommandLineRunnerTest.testSimpleModeLeavesUnusedParams(CommandLineRunnerTest.java:156)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at junit.framework.TestCase.runTest(TestCase.java:177)
        at junit.framework.TestCase.runBare(TestCase.java:142)
        at junit.framework.TestResult$1.protect(TestResult.java:122)
        at junit.framework.TestResult.runProtected(TestResult.java:142)
        at junit.framework.TestResult.run(TestResult.java:125)
        at junit.framework.TestCase.run(TestCase.java:130)
        at junit.framework.TestSuite.runTest(TestSuite.java:241)
        at junit.framework.TestSuite.run(TestSuite.java:236)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at TestRunner.main(TestRunner.java:12)
Caused by: java.lang.RuntimeException: unexpected error invoking equal_dcomp_instrumented
        at daikon.dcomp.DCRuntime.dcomp_equals(DCRuntime.java:273)
        at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:947)
        at sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:55)
        at sun.util.locale.BaseLocale.getInstance(BaseLocale.java:87)
        at java.util.Locale.<init>(Locale.java:650)
        at java.util.Locale.<init>(Locale.java:701)
        at com.google.javascript.rhino.head.ScriptRuntime.<clinit>(ScriptRuntime.java:126)
        ... 31 more
Caused by: java.lang.IllegalAccessException: Class daikon.dcomp.DCRuntime can not access a member of class sun.util.locale.BaseLocale$Key with modifiers "public"
        at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
        at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296)
        at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288)
        at java.lang.reflect.Method.invoke(Method.java:491)
        at daikon.dcomp.DCRuntime.dcomp_equals(DCRuntime.java:271)
        ... 37 more
[testSimpleModeLeavesUnusedParams(com.google.javascript.jscomp.CommandLineRunnerTest): null]
FAILURE
java.lang.NoClassDefFoundError: Could not initialize class com.google.javascript.rhino.head.ScriptRuntime
        at com.google.javascript.jscomp.RhinoErrorReporter.<init>(RhinoErrorReporter.java:77)
        at com.google.javascript.jscomp.RhinoErrorReporter.<init>(RhinoErrorReporter.java:32)
        at com.google.javascript.jscomp.RhinoErrorReporter$OldRhinoErrorReporter.<init>(RhinoErrorReporter.java:144)
        at com.google.javascript.jscomp.RhinoErrorReporter$OldRhinoErrorReporter.<init>(RhinoErrorReporter.java:140)
        at com.google.javascript.jscomp.RhinoErrorReporter.forOldRhino(RhinoErrorReporter.java:109)
        at com.google.javascript.jscomp.Compiler.<init>(Compiler.java:168)
        at com.google.javascript.jscomp.CommandLineRunner.createCompiler(CommandLineRunner.java:815)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.doRun(AbstractCommandLineRunner.java:744)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.run(AbstractCommandLineRunner.java:383)
        at com.google.javascript.jscomp.CommandLineRunnerTest.compile(CommandLineRunnerTest.java:1303)
        at com.google.javascript.jscomp.CommandLineRunnerTest.test(CommandLineRunnerTest.java:1186)
        at com.google.javascript.jscomp.CommandLineRunnerTest.test(CommandLineRunnerTest.java:1175)
        at com.google.javascript.jscomp.CommandLineRunnerTest.testForwardDeclareDroppedTypes(CommandLineRunnerTest.java:754)[testForwardDeclareDroppedTypes(com.google.javascript.jscomp.CommandLineRunnerTest): null]
FAILURE

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at junit.framework.TestCase.runTest(TestCase.java:177)
        at junit.framework.TestCase.runBare(TestCase.java:142)
        at junit.framework.TestResult$1.protect(TestResult.java:122)
        at junit.framework.TestResult.runProtected(TestResult.java:142)
        at junit.framework.TestResult.run(TestResult.java:125)
        at junit.framework.TestCase.run(TestCase.java:130)
        at junit.framework.TestSuite.runTest(TestSuite.java:241)
        at junit.framework.TestSuite.run(TestSuite.java:236)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at TestRunner.main(TestRunner.java:12)
java.lang.NoClassDefFoundError: Could not initialize class com.google.javascript.rhino.head.ScriptRuntime
        at com.google.javascript.jscomp.RhinoErrorReporter.<init>(RhinoErrorReporter.java:77)
        at com.google.javascript.jscomp.RhinoErrorReporter.<init>(RhinoErrorReporter.java:32)
        at com.google.javascript.jscomp.RhinoErrorReporter$OldRhinoErrorReporter.<init>(RhinoErrorReporter.java:144)
        at com.google.javascript.jscomp.RhinoErrorReporter$OldRhinoErrorReporter.<init>(RhinoErrorReporter.java:140)
        at com.google.javascript.jscomp.RhinoErrorReporter.forOldRhino(RhinoErrorReporter.java:109)
        at com.google.javascript.jscomp.Compiler.<init>(Compiler.java:168)
        at com.google.javascript.jscomp.CommandLineRunner.createCompiler(CommandLineRunner.java:815)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.doRun(AbstractCommandLineRunner.java:744)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.run(AbstractCommandLineRunner.java:383)
        at com.google.javascript.jscomp.CommandLineRunnerTest.compile(CommandLineRunnerTest.java:1303)
        at com.google.javascript.jscomp.CommandLineRunnerTest.test(CommandLineRunnerTest.java:1186)
        at com.google.javascript.jscomp.CommandLineRunnerTest.test(CommandLineRunnerTest.java:1175)
        at com.google.javascript.jscomp.CommandLineRunnerTest.test(CommandLineRunnerTest.java:1167)
        at com.google.javascript.jscomp.CommandLineRunnerTest.testDebugFlag1(CommandLineRunnerTest.java:476)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at junit.framework.TestCase.runTest(TestCase.java:177)
        at junit.framework.TestCase.runBare(TestCase.java:142)
        at junit.framework.TestResult$1.protect(TestResult.java:122)
        at junit.framework.TestResult.runProtected(TestResult.java:142)
        at junit.framework.TestResult.run(TestResult.java:125)
        at junit.framework.TestCase.run(TestCase.java:130)
        at junit.framework.TestSuite.runTest(TestSuite.java:241)
        at junit.framework.TestSuite.run(TestSuite.java:236)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at TestRunner.main(TestRunner.java:12)
[testDebugFlag1(com.google.javascript.jscomp.CommandLineRunnerTest): null]
FAILURE
[testIssue787(com.google.javascript.jscomp.IntegrationTest): Could not initialize class com.google.javascript.rhino.head.ScriptRuntime]
FAILURE
[testRemoveGlobal1(com.google.javascript.jscomp.RemoveUnusedVarsTest): Could not initialize class com.google.javascript.rhino.head.ScriptRuntime]
FAILURE
[testRemoveGlobal2(com.google.javascript.jscomp.RemoveUnusedVarsTest): Could not initialize class com.google.javascript.rhino.head.ScriptRuntime]
FAILURE
[testRemoveGlobal3(com.google.javascript.jscomp.RemoveUnusedVarsTest): Could not initialize class com.google.javascript.rhino.head.ScriptRuntime]
FAILURE
[testIssue168b(com.google.javascript.jscomp.RemoveUnusedVarsTest): Could not initialize class com.google.javascript.rhino.head.ScriptRuntime]
FAILURE

However, if I run the tests without DynComp, all the tests passed.

Below are the steps to reproduce the issue,
1. install defects4j, https://github.com/rjust/defects4j 
2. checkout the Closure1f using `defects4j checkout -p Closure -v 1f -w Closure1f`
3. go to Closure1f and compile the project using `defects4j compile`
4. compile the attached TestRunner.java
5. go to Closure1f and run `CLASSPATH=$(find "$PWD" -name '*.jar' -type f -printf ':%p\n' | sort -u | tr -d '\n'); java -Xmx43G -cp $DAIKONDIR/daikon.jar:build/classes/:build/test/$CLASSPATH:<TestRunner path> daikon.DynComp '--ppt-select-pattern=^com\.google\.javascript\.jscomp\.RemoveUnusedVars' TestRunner com.google.javascript.jscomp.CommandLineRunnerTest::testSimpleModeLeavesUnusedParams com.google.javascript.jscomp.CommandLineRunnerTest::testForwardDeclareDroppedTypes com.google.javascript.jscomp.CommandLineRunnerTest::testDebugFlag1 com.google.javascript.jscomp.IntegrationTest::testIssue787 com.google.javascript.jscomp.RemoveUnusedVarsTest::testRemoveGlobal1 com.google.javascript.jscomp.RemoveUnusedVarsTest::testRemoveGlobal2 com.google.javascript.jscomp.RemoveUnusedVarsTest::testRemoveGlobal3 com.google.javascript.jscomp.RemoveUnusedVarsTest::testIssue168b`, you will need to replace the <TestRunner path> to the path of the compile TestRunner at step 4.
Then you should see the issue. 
Please let me know if there are any problem to reproduce the issue. Thank you very much for your help and your time.

Regards,
Bo Yang 

TestRunner.java

Mark Roberts

unread,
May 10, 2021, 2:29:02 PM5/10/21
to Daikon discuss

I’m pretty sure this is a duplicate of https://github.com/codespecs/daikon/issues/304

In my comments there I show a suggested way to work around your nonstandard way of calling Junit.  I believe your version of tr3.java would need to have little test methods for each of:

com.google.javascript.jscomp.CommandLineRunnerTest::testSimpleModeLeavesUnusedParams

com.google.javascript.jscomp.CommandLineRunnerTest::testForwardDeclareDroppedTypes 

com.google.javascript.jscomp.CommandLineRunnerTest::testDebugFlag1 

com.google.javascript.jscomp.IntegrationTest::testIssue787 

com.google.javascript.jscomp.RemoveUnusedVarsTest::testRemoveGlobal1 

com.google.javascript.jscomp.RemoveUnusedVarsTest::testRemoveGlobal2 

com.google.javascript.jscomp.RemoveUnusedVarsTest::testRemoveGlobal3 

com.google.javascript.jscomp.RemoveUnusedVarsTest::testIssue168b

 Let me know if this works,

Mark Roberts

boyan...@gmail.com

unread,
May 10, 2021, 5:01:38 PM5/10/21
to Daikon discuss
Hi Mark,

Thank you for your help.

I wrote a helper as your example but it still reports the same exceptions in my original post.
Below is my test helper:
import org.junit.Test;

public class TestIt {
    @Test
    public void testIt() throws Exception {
         com.google.javascript.jscomp.CommandLineRunnerTest test = new com.google.javascript.jscomp.CommandLineRunnerTest();
         test.setUp();
         test.testSimpleModeLeavesUnusedParams();
    }
}
First to compile it and the command to run it should be `CLASSPATH=$(find "$PWD" -name '*.jar' -type f -printf ':%p\n' | sort -u | tr -d '\n'); java -Xmx43G -cp $DAIKONDIR/daikon.jar:build/classes/:build/test/$CLASSPATH:<TestHelper path> daikon.DynComp '--ppt-select-pattern=^com\.google\.javascript\.jscomp\.RemoveUnusedVars' org.junit.runner.JUnitCore TestIt`
Thank you again for your time.

Regards,
Bo Yang

Mark Roberts

unread,
May 17, 2021, 1:24:25 PM5/17/21
to Daikon discuss
I found the problem and a fix was checked into https://github.com/codespecs/daikon on May 12.  I believe you can use your original TestRunner as well.
Mark

boyan...@gmail.com

unread,
May 18, 2021, 11:23:28 AM5/18/21
to Daikon discuss
Thank you very much for your help!

Regards,
Bo
Reply all
Reply to author
Forward
0 new messages