Bug 75129 - NPE on thisJoinPoint mistake
Summary: NPE on thisJoinPoint mistake
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.2.1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-27 17:18 EDT by Wes Isberg CLA
Modified: 2004-10-21 04:32 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wes Isberg CLA 2004-09-27 17:18:47 EDT
The following mistake causes a NPE:

// mistake caused compiler crash rather than error
thisJoinPoint.getSignature.toLongString()  // CE 22
// correct
//thisJoinPointStaticPart.getSignature().toLongString() 

Top of stack trace:

org.aspectj.ajdt.internal.compiler.ast.ThisJoinPointVisitor.getEquivalentStaticBinding(ThisJoinPointVisitor.java:178)
	at
org.aspectj.ajdt.internal.compiler.ast.ThisJoinPointVisitor.replaceEffectivelyStaticRef(ThisJoinPointVisitor.java:173)
	at
org.aspectj.ajdt.internal.compiler.ast.ThisJoinPointVisitor.visit(ThisJoinPointVisitor.java:142)
	at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:341)
	at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.BinaryExpression.traverse(BinaryExpression.java:1756)

See test at tests/bugs/TjpMistake.java
Comment 1 Andrew Clement CLA 2004-09-30 04:26:47 EDT
Fixed checked in (and testcase moved from ajcTestsFailing to ajc121-tests.xml).

The fix is in the optimization code for method calls on this join point objects
which says that if the call could be satisfied by a method on
thisJoinPointStaticPart then use that rather than thisJoinPoint.  The fix is to
say that if the binding for the target of the call is null then don't attempt
the optimization (because we are about to put out an error for this line of code
anyway!).

Waiting for build before closing bug.
Comment 2 Andrew Clement CLA 2004-09-30 10:52:13 EDT
Fix available:

BUILD COMPLETE -  build.379
Date of build: 09/30/2004 12:34:06
Time to build: 105 minutes 47 seconds
Last changed: 09/30/2004 09:18:34
Last log entry: Fix for Bugzilla Bug 75129 NPE on thisJoinPoint mistake
Latest good AspectJ jar available at:
download.eclipse.org/technology/ajdt/dev/aspectj-DEVELOPMENT.jar
Comment 3 Adrian Colyer CLA 2004-10-21 04:32:35 EDT
Fix released as part of AspectJ 1.2.1