Bug 290227 - NPE when using @AspectJ classes compiled with javac at ReferencePointcut.java:356
Summary: NPE when using @AspectJ classes compiled with javac at ReferencePointcut.java...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.6.5   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 1.6.6   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-23 05:06 EDT by Jakub Holy CLA
Modified: 2009-09-23 12:01 EDT (History)
1 user (show)

See Also:


Attachments
Archiive with source codes and commands demonstrating the issue (102.90 KB, application/x-zip)
2009-09-23 05:09 EDT, Jakub Holy CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Holy CLA 2009-09-23 05:06:55 EDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.14) Gecko/2009090216 Ubuntu/9.04 (jaunty) Firefox/3.0.14
Build Identifier: 1.6.5

When I compile my aspects defined with the annotations-based approach (aka @AspectJ) with javac and then use ajc to weave statically them into some classes then ajc fails with NullPointerException at org.aspectj.weaver.patterns.ReferencePointcut.concretize1(ReferencePointcut.java:356)

Since the aspects are normal .java files with special annotations then I don't see the reason why I couldn't compile them with javac. And even if there is a reason to require their compilation with ajc, it should throw a meaningful and helpful error instead of NPE (e.g. "May be the aspect classes have been compiled with javac instead of ajc as required, recompile them with ajc.").

I'll attach a zip file that demonstrates the issue, see the steps to reproduce.

Using AspectJ 1.6.5

Reproducible: Always

Steps to Reproduce:
1.Unzip the attached aspectj-issue-demonstration.zip to /tmp
2 enter into the created /tmp/aspectj
3.(Optional) re-compile the aspect classes located in /tmp/aspectj/aspects/ by executing the provided javac.sh; or you may use those already present at javac_build/
3.Run ajc using the provided ajc.sh
4.Ajc will fail with the error stored in ajc.log.
Comment 1 Jakub Holy CLA 2009-09-23 05:09:03 EDT
Created attachment 147869 [details]
Archiive with source codes and commands demonstrating the issue
Comment 2 Andrew Clement CLA 2009-09-23 11:34:26 EDT
> Since the aspects are normal .java files with special annotations then I don't
> see the reason why I couldn't compile them with javac. 

Yes, that is the intended design, you can just use javac.

> And even if there is a reason to require their compilation with ajc, 
> it should throw a meaningful and helpful error instead of NPE

Yep, the compiler should never NPE regardless of what the user does.
Comment 3 Andrew Clement CLA 2009-09-23 12:01:04 EDT
fix committed.

The problem here is that the scope pointcut is blank.  The pointcut resolver could not cope with that for an annotation style pointcut.

The blank pointcut matches nothing so the effect here should be that the entire compound pointcut doesn't match anything.

thanks for the test program.