Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317139 - NullPointerException during weaving
Summary: NullPointerException during weaving
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Runtime (show other bugs)
Version: 1.6.8   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 1.6.9   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-17 01:50 EDT by Oliver Drotbohm CLA
Modified: 2010-06-29 11:29 EDT (History)
1 user (show)

See Also:


Attachments
AspectJ compile log (31.01 KB, text/plain)
2010-06-17 01:50 EDT, Oliver Drotbohm CLA
no flags Details
Project causing the issue (576.52 KB, application/zip)
2010-06-22 09:37 EDT, Oliver Drotbohm CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Drotbohm CLA 2010-06-17 01:50:24 EDT
Created attachment 172090 [details]
AspectJ compile log

Using the Maven plugin to compile aspects into my code I get the following exception:

…
---- Exception Information ---
java.lang.NullPointerException
        at org.aspectj.weaver.bcel.BcelObjectType.ensureGenericSignatureUnpacked(BcelObjectType.java:823)
        at org.aspectj.weaver.bcel.BcelObjectType.getSuperclass(BcelObjectType.java:228)
        at org.aspectj.weaver.ReferenceType.getSuperclass(ReferenceType.java:905)
        at org.aspectj.weaver.bcel.AtAjAttributes.handleAspectAnnotation(AtAjAttributes.java:490)
        at org.aspectj.weaver.bcel.AtAjAttributes.readAj5ClassAttributes(AtAjAttributes.java:234)
…

I have attached the complete log as attachment.
Comment 1 Andrew Clement CLA 2010-06-17 17:24:54 EDT
Is there any way you could share with me the project that causes this?

I'm nervous about just putting in a guard for the NPE and would rather understand what is leading to the failure.  It appears a raw/parameterized type has forgotten its generic type somehow.
Comment 2 Oliver Drotbohm CLA 2010-06-22 09:37:41 EDT
Created attachment 172413 [details]
Project causing the issue

It's perfectly possible that I am messing things up here :). But even in this case I think a more expressive exception would be useful.

Attached the project. Running mvn clean test-compile should produce the error log files.
Comment 3 Andrew Clement CLA 2010-06-28 20:06:37 EDT
thanks for the project.

The NPE is occurring (I assert) because the generic type is being used before it has been set.  A particular path is being taken into the generic signature unpacker and it is too early to assume the generic type has been set.  If we guard on null, it looks like the caller will subsequently set the generic type correctly, so that is what I'll do.
Comment 4 Andrew Clement CLA 2010-06-29 11:29:50 EDT
After building an AspectJ with the proposed change in, I see that the NPE was hiding a real error in the project:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Compiler errors :
error at <Unknown>::0 The generic aspect 'org.synyx.hades.domain.auditing.AuditingAdvice' must be declared abstract

I'll publish this build today as AspectJ 1.6.9.RC2