Bug 249710 - [compiling] Problem with -XterminateAfterCompilation
Summary: [compiling] Problem with -XterminateAfterCompilation
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.6.3   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-05 18:24 EDT by Andrew Clement CLA
Modified: 2008-10-29 15:03 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2008-10-05 18:24:39 EDT
Reported on the mailing list by Simone:

I tried disabling pipelining as described in bug 146781, that is using
-Xset:pipelineCompilation=false, but unfortunately I get this error
while compiling with -XterminateAfterCompilation :

java.lang.NullPointerException
       at org.aspectj.weaver.ReferenceType.isAspect(ReferenceType.java:160)
       at
org.aspectj.ajdt.internal.core.builder.AjBuildManager$4.addAspectName(AjBuildManager.java:1108)
       at
org.aspectj.ajdt.internal.core.builder.AjBuildManager$4.acceptResult(AjBuildManager.java:1047)
       at
Comment 1 Andrew Clement CLA 2008-10-22 17:50:57 EDT
I've been trying to recreate this, but I can't so can't make a fix.

The stack trace is from the logic driven due to -outxml being specified.  However, I have no clue why the delegate is null when isAspect() is being called against the reference type.  I have a few bugs where the delegate is unexpectedly null, I don't yet know if they all have the same root cause.

I've tried combining -XterminateAfterCompilation and -Xset:pipelineCompilation=false but it doesn't fail.  Can you tell me if the code you are processing with the command that fails has already been woven in an earlier compile?
Comment 2 Simone Gianni CLA 2008-10-23 11:44:50 EDT
Hi Andy,
now that I have better knowledge of the testing system, I'll try to setup a test case.

Anyway, most probably it is already pre-woven with other aspects. It is inside a maven build of multiple modules, all having aspects.

Removing -outxml works like a charm.
Comment 3 Andrew Clement CLA 2008-10-29 15:03:29 EDT
I just committed a fix under another bug for a null delegate (which is the situation here too).  The problem was that the delegate was null for a type generated during the compilation process (eg. a marker interface for a perclause).  If the problems here with -XterminateAfterCompilation and -outxml also involved aspects with perclauses (or some other construct that would lead to generation of a class at compile time) then it may be the same issue here and so also resolved.

Here is a program that crashes:

public aspect Foo perthis(execution(* *(..))) {
}


ajc -1.5 -XterminateAfterCompilation -outxml Foo.java

java.lang.NullPointerException
        at org.aspectj.weaver.ReferenceType.isAspect(ReferenceType.java:165)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager$4.addAspectName(AjBuildManager.java:1095)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager$4.acceptResult(AjBuildManager.java:1040)

I've confirmed this is now fixed in AspectJ.  No dev build for a while due to test failures on the build machine (classpath related) - fix will be in next successful dev build.