Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340323 - NPE when weaving java.lang.Object at org.aspectj.weaver.bcel.BcelTypeMunger.createAnyBridgeMethodsForCovariance(BcelTypeMunger.java:1251)
Summary: NPE when weaving java.lang.Object at org.aspectj.weaver.bcel.BcelTypeMunger.c...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.6.11   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.6.12   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-17 10:34 EDT by Owen Stephens CLA
Modified: 2011-03-28 15:37 EDT (History)
1 user (show)

See Also:


Attachments
AJ core dump (10.36 KB, text/plain)
2011-03-17 10:34 EDT, Owen Stephens CLA
no flags Details
Test class (140 bytes, text/plain)
2011-03-17 10:35 EDT, Owen Stephens CLA
no flags Details
Aspect with inter-type declaration causing NPE. (85 bytes, text/plain)
2011-03-17 10:36 EDT, Owen Stephens CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Stephens CLA 2011-03-17 10:34:56 EDT
Created attachment 191423 [details]
AJ core dump

I'm trying to add a method to Object using a inter-type declaration. When calling ajc, I encounter a NPE. From a cursory glance, it would appear that the code is looking for the parents classes of Object, which presumably is null.

I've attached the dump and a simple example that causes it.
Comment 1 Owen Stephens CLA 2011-03-17 10:35:42 EDT
Created attachment 191424 [details]
Test class
Comment 2 Owen Stephens CLA 2011-03-17 10:36:20 EDT
Created attachment 191425 [details]
Aspect with inter-type declaration causing NPE.
Comment 3 Owen Stephens CLA 2011-03-24 09:45:40 EDT
Note that this only happens if the compliance level is set to 1.6 or 1.5. The example test case I gave doesn't require this level, but my original code will not compile without it, since it uses generics.
Comment 4 Owen Stephens CLA 2011-03-25 16:40:52 EDT
I wasn't able to build the sources, but I was able to manually modify the class file, within the jar. I added a null reference check for the createAnyBridgeMethodsForCovariance method, around line 1250 of BcelTypeMunger.java. ajc now compiles the test example correctly.
Comment 5 Andrew Clement CLA 2011-03-28 15:37:46 EDT
Hi,

Sorry I didn't reply sooner.

I've put in the null check, I think I've done the same as you have tried out.  I don't have a test harness for checking weaving against JDK classes so haven't added a regression test.  I've never heard anyone weave into Object like that either, but I guess it is working for you :)

Fix will be in 1.6.12.