NoSuchMethodError when analyzing annotations

72 views
Skip to first unread message

Patrick McAfee

unread,
Nov 26, 2014, 11:35:47 AM11/26/14
to java-pa...@googlegroups.com
When running Java Pathfinder against certain jars, I get the following message:

gov.nasa.jpf.vm.NoUncaughtExceptionsProperty
java.lang.NoSuchMethodError: org.robolectric.annotation.Config.annotationType()

It appears that JPF is not able to find the annotationType function for annotations at runtime, which is a part of the JDK.  I have added the source of the function, tools.jar, to the classpath.    I am currently running against Java 1.7 on Linux.  The source of the jar under test appears fine and works correctly on its own when not being run through JPF

Source for the annotation class it's choking on.  Not something I wrote, but it looks fine to me.

Does anyone have any idea what could be causing this?  I'm suspecting it's some kind of classpath weirdness, but everything on the classpath looks fine.

Thanks!

Peter Mehlitz

unread,
Nov 26, 2014, 3:11:34 PM11/26/14
to java-pa...@googlegroups.com
no idea. Check from where org.robolectric.annotation.Config is loaded (+log.info=class) and see if this classfile has a annotationType() method (e.g. with bin/print_class).

What does the (JPF reported) stack trace look like (who is calling annotationType() on what object) ?

-- Peter

Patrick McAfee

unread,
Nov 26, 2014, 4:28:00 PM11/26/14
to java-pa...@googlegroups.com
I know exactly where the class is coming from, so that's not an issue.  After running the print_class script on it, it appears that the annotationType() method isn't being added to it- which is strange, as it's part of the JDK base annotation class - which it claims to be inheriting/implementing.  I'm not sure why it wouldn't be added.  Thinks are a little strange due to the whole annotation/interface thing.  As far as I know, it SHOULD be getting the method as just isn't.

Looks like the issue might lie with the library I'm using.

Stack trace: 

java.lang.NoSuchMethodError: org.robolectric.annotation.Config.annotationType()
at com.sun.proxy.$Proxy0.<clinit>
at java.lang.reflect.Constructor.newInstance(gov.nasa.jpf.vm.JPF_java_lang_reflect_Constructor)
at java.lang.reflect.Proxy.newInstance(Proxy.java:764)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:755)
at org.robolectric.util.AnnotationUtil.defaultsFor(AnnotationUtil.java:13)
at org.robolectric.RobolectricTestRunner.getConfig(RobolectricTestRunner.java:373)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:181)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:158)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
at tester.DatClass.main(DatClass.java:12)

PETER C MEHLITZ

unread,
Nov 27, 2014, 2:29:59 PM11/27/14
to java-pa...@googlegroups.com
I see - dynamic class creation. Probably something in sun.misc.ProxyGenerator that has to be modeled.
If you provide a simple java.lang.reflect.Proxy test case I can have a look. Make sure your test class has the same hierarchy and annotationType() annotations.

-- Peter


On Nov 26, 2014, at 1:28 PM, Patrick McAfee <pjm...@g.rit.edu> wrote:

> I know exactly where the class is coming from, so that's not an issue. After running the print_class script on it, it appears that the annotationType() method isn't being added to it- which is strange, as it's part of the JDK base annotation class - which it claims to be inheriting/implementing. I'm not sure why it wouldn't be added. Thinks are a little strange due to the whole annotation/interface thing. As far as I know, it SHOULD be getting the method as just isn't.
>
> Looks like the issue might lie with the library I'm using.
>
> Stack trace:
>
> java.lang.NoSuchMethodError: org.robolectric.annotation.Config.annotationType()
> at com.sun.proxy.$Proxy0.<clinit>
> at java.lang.reflect.Constructor.newInstance(gov.nasa.jpf.vm.JPF_java_lang_reflect_Constructor)
> at java.lang.reflect.Proxy.newInstance(Proxy.java:764)
> at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:755)
> at org.robolectric.util.AnnotationUtil.defaultsFor(AnnotationUtil.java:13)
> at org.robolectric.RobolectricTestRunner.getConfig(RobolectricTestRunner.java:373)
...

PETER C MEHLITZ

unread,
Nov 28, 2014, 7:05:35 PM11/28/14
to java-pa...@googlegroups.com
never mind - nothing wrong with your classes, there was just a incompatibility in the ClassInfo.getReflectionMethod() implementation. Will be fixed in the next update

-- Peter


On Nov 26, 2014, at 1:28 PM, Patrick McAfee <pjm...@g.rit.edu> wrote:

Patrick McAfee

unread,
Nov 28, 2014, 7:26:16 PM11/28/14
to java-pa...@googlegroups.com
So when this implementation is fixed, that will remove the NoSuchMethodError?

PETER C MEHLITZ

unread,
Nov 28, 2014, 10:01:10 PM11/28/14
to java-pa...@googlegroups.com
yes. It's already fixed but it will take a couple days until I can push to the public repository

-- Peter

Patrick McAfee

unread,
Dec 1, 2014, 6:34:01 PM12/1/14
to java-pa...@googlegroups.com
I just pulled and tried to build against the latest version, with the fix.  I now get a different error.  I've attached a DEBUG level log, the error I've pasted below occurs directly after this output.  I have a copy at the FINER level, but it's 142MB

java.lang.NullPointerException
at gov.nasa.jpf.symbc.bytecode.INVOKEINTERFACE.execute(INVOKEINTERFACE.java:45)
at gov.nasa.jpf.vm.ThreadInfo.executeInstruction(ThreadInfo.java:1890)
at gov.nasa.jpf.vm.ThreadInfo.executeTransition(ThreadInfo.java:1848)
at gov.nasa.jpf.vm.SystemState.executeNextTransition(SystemState.java:733)
at gov.nasa.jpf.vm.VM.forward(VM.java:1719)
at gov.nasa.jpf.search.Search.forward(Search.java:580)
at gov.nasa.jpf.search.Simulation.search(Simulation.java:58)
at gov.nasa.jpf.JPF.run(JPF.java:613)
at gov.nasa.jpf.JPF.start(JPF.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at gov.nasa.jpf.tool.Run.call(Run.java:81)
at gov.nasa.jpf.tool.RunJPF.main(RunJPF.java:117)

Patrick McAfee

unread,
Dec 1, 2014, 6:37:04 PM12/1/14
to java-pa...@googlegroups.com
Correction - NOW I have attached the log.
log.txt
Reply all
Reply to author
Forward
0 new messages