Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364961 - [xtend] member initializer with refs to member vars compile to invalid java code
Summary: [xtend] member initializer with refs to member vars compile to invalid java code
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X
: P3 major (vote)
Target Milestone: M4   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-28 10:09 EST by Moritz Eysholdt CLA
Modified: 2017-09-19 18:01 EDT (History)
1 user (show)

See Also:
moritz.eysholdt: juno+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Eysholdt CLA 2011-11-28 10:09:47 EST
The snippet

---
class bar {
	int i = 12
	int x = i + 1 
}
---

compiles to 

---
public class bar {
  private int i = 12;
  
  private int x = new Function0<Integer>() {
    public Integer apply() {
      int _operator_plus = IntegerExtensions.operator_plus(((Integer)this.i), ((Integer)1));
      return _operator_plus;
    }
  }.apply();
}
---

which doesn't compile due to the error "i cannot be resolved or is not a field" under "this.i".

I'd expect "bar.this.i" to be generated by the compiler instead of "this.i".
Comment 1 Sebastian Zarnekow CLA 2011-11-28 11:33:45 EST
Pushed to master.
Comment 2 Karsten Thoms CLA 2017-09-19 17:51:00 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 18:01:46 EDT
Closing all bugs that were set to RESOLVED before Neon.0