Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326098 - [compiler] NPE when base ctor with arg lowering is used as an expression
Summary: [compiler] NPE when base ctor with arg lowering is used as an expression
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTJ (show other bugs)
Version: 0.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 0.7.1   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-23 16:12 EDT by Stephan Herrmann CLA
Modified: 2010-09-23 18:32 EDT (History)
0 users

See Also:


Attachments
fix (1.05 KB, patch)
2010-09-23 16:24 EDT, Stephan Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2010-09-23 16:12:57 EDT
This was observed when simplifying OTTypeHierarchyes.ConnectedPhantomType
and has been reconstructed as test236_constructorWithBasecall7():

when leveraging bug 323862 in a situation where an argument to the
base constructor requires lowering, the following NPE would occur:

Caused by: java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.isCompatibleWith(ReferenceBinding.java:1322)
	at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.isCompatibleWith(ReferenceBinding.java:1308)
	at org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transformer.InsertTypeAdjustmentsVisitor.maybeWrap(InsertTypeAdjustmentsVisitor.java:279)
	at org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transformer.InsertTypeAdjustmentsVisitor.endVisit(InsertTypeAdjustmentsVisitor.java:76)
	at org.eclipse.jdt.internal.compiler.ast.Assignment.traverse(Assignment.java:273)
	at org.eclipse.objectteams.otdt.internal.core.compiler.ast.BaseAllocationExpression.traverse(BaseAllocationExpression.java:333)
	at org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall.traverse(ExplicitConstructorCall.java:829)
	at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.resolveStatements(ConstructorDeclaration.java:793)
 ...
Comment 1 Stephan Herrmann CLA 2010-09-23 16:24:59 EDT
Created attachment 179486 [details]
fix

The lowering request triggered the InsertTypeAdjustmentsVisitor,
which traversed the BaseAllocationExpression as an Assignment,
but the lhs has not been developed (i.e., resolved), because
the node actually is not a statement but an expression,
thus the NPE.

Fixed by one more check for isExpression.
Comment 2 Stephan Herrmann CLA 2010-09-23 16:28:32 EDT
Patch has been committed as r835.
Comment 3 Stephan Herrmann CLA 2010-09-23 18:32:34 EDT
Verified using I201009231632