Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317139

Summary: NullPointerException during weaving
Product: [Tools] AspectJ Reporter: Oliver Drotbohm <odrotbohm>
Component: RuntimeAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aclement
Version: 1.6.8   
Target Milestone: 1.6.9   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
AspectJ compile log
none
Project causing the issue none

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