Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354480 - VerifyError due to bogus lowering in inferred callout-to-field
Summary: VerifyError due to bogus lowering in inferred callout-to-field
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTJ (show other bugs)
Version: 2.0   Edit
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: 2.2 M2   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-11 07:39 EDT by Stephan Herrmann CLA
Modified: 2013-02-23 10:18 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2011-08-11 07:39:41 EDT
In my null annotation implementation I had code like this

protected class ReturnStatement extends NodeWithBits playedBy ReturnStatement {
	Expression getExpression() 	-> get Expression expression;
	FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) 
	<- replace FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo);
		
	callin FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
		if (this.expression != null) {
			this.expression.analyseCode(currentScope, flowContext, flowInfo);
	...

The generated code triggered a VerifyError because the inferred c-t-f
for this.exression (last line) bogusly tried to lower the receiver (this) 
to the base version of ReturnStatement.

It seems the compiler couldn't decide whether to use the existing
explicit c-t-f (use this) or to directly access the base field 
(use lower(this)).

OTOH, also lowering for the argument currentScope had a finger in the pie
(workaround: make this lowering explicit). This could indicate that the
loweringRequired flag was consumed at a wrong location.

Might/might not be related to bug 352914 or bug 353894 comment 13.
Comment 1 Stephan Herrmann CLA 2011-08-27 10:30:21 EDT
VerifyError is bad, schedule for M2.
Comment 2 Stephan Herrmann CLA 2012-09-22 09:32:49 EDT
This was closed by accident.
The error can still be reproduced.
Comment 3 Stephan Herrmann CLA 2012-09-22 10:41:24 EDT
This is what caused the error:

- lowering of the BlockScope arg caused Config.requireTypeAdjustment()
  which triggered the InsertTypeAdjustmentsVisitor
- inside InsertTypeAdjustmentsVisitor a lowering conversion was inserted
  for the fieldReference this.expression

The fix consists of one additional check:
- don't add lowering conversion for a field reference that already has
  a syntheticAccessor w/ purpose InferredCalloutToField

Released for 2.2 M2 via commit 47700cc09e0d3152088b67bbb6920af31adc19d2.
Comment 4 Stephan Herrmann CLA 2013-02-23 10:18:02 EST
Verified using 2.2 M5