#46 NPE in AIB.getMethodAnnotation(AIB.java:175)

closed-fixed
nobody
None
5
2007-02-03
2006-09-20
Jochen Hiller
No

Hi,

I am just trying to backward port JUnit 4.1 to JDK 1.4
using RetroWeaver. I tried it with previous versions
(1.2.2, 1.2.5) but failed due to missing reflection
support for annotations.

With 2.0Beta1 (with reflection support) I will come
forward, but now stepped into NPE within internal
implementation.

See stack trace:

[echo] Calling weaved with JDK 1.5
[java] JUnit version 4.1
[java] .E
[java] Time: 0
[java] There was 1 failure:
[java] 1)
initializationError0(org.junit.tests.AllTests)
[java] java.lang.NullPointerException
[java] at
net.sourceforge.retroweaver.runtime.java.lang.annotation.AIB.getMethodAnnotation(AIB.java:175)
[java] at
net.sourceforge.retroweaver.runtime.java.lang.reflect.Method_.getAnnotation(Method_.java:35)
[java] at
org.junit.internal.runners.TestIntrospector.getTestMethods(TestIntrospector.java:28)
[java] at
org.junit.internal.runners.MethodValidator.validateTestMethods(MethodValidator.java:60)
[java] at
org.junit.internal.runners.MethodValidator.validateStaticMethods(MethodValidator.java:34)
[java] at
org.junit.internal.runners.MethodValidator.validateAllMethods(MethodValidator.java:40)
[java] at
org.junit.internal.runners.TestClassRunner.validate(TestClassRunner.java:33)
[java] at
org.junit.internal.runners.TestClassRunner.<init>(TestClassRunner.java:27)
[java] at
org.junit.runners.Suite.<init>(Suite.java:41)
[java] at
org.junit.runners.Suite.<init>(Suite.java:34)
[java] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
[java] at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[java] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[java] at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
[java] at
org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
[java] at
org.junit.internal.requests.ClassesRequest.getRunner(ClassesRequest.java:23)
[java] at
org.junit.runner.JUnitCore.run(JUnitCore.java:100)
[java] at
org.junit.runner.JUnitCore.run(JUnitCore.java:91)
[java] at
org.junit.runner.JUnitCore.runMain(JUnitCore.java:75)
[java] at
org.junit.runner.JUnitCore.main(JUnitCore.java:42)
[java] FAILURES!!!
[java] Tests run: 1, Failures: 1
[java] Java Result: 1

I can provide a build file, whereas the test can be
done with a simple ANT script.

You have to download and copy junit41.zip, and
retroweaver-2.0Beta1.zip into the ./3rdParty directory.
Then adapt your local settings to JDK 1.4 / 1.5 in
./build.local.properties, and call the target "test".
Then you should get the same stack trace as above.

It seems some bug between weaving and runtime
expectations. I did not stepped into more details until
now.

Thanks, Jochen

RetroWeaver is really COOL !!!

Discussion

  • Jochen Hiller
    Jochen Hiller
    2006-09-20

    Sample files for test cases

     
    Attachments
  • Logged In: YES
    user_id=1373398
    Originator: NO

    This is now fixed in 2.0 Beta 4. All junit 4.1 and cvs version pass with the newer beta.

    Xavier

     
    • status: open --> closed-fixed