Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341246

Summary: [xtend] Compiler produces illegal java
Product: [Modeling] TMF Reporter: Sebastian Zarnekow <sebastian.zarnekow>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sven.efftinge
Version: 2.0.0Flags: sebastian.zarnekow: indigo+
Target Milestone: M7   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sebastian Zarnekow CLA 2011-03-29 11:17:58 EDT
foo() {
  new StringBuilderBasedAppendable(null)
  '''
  '''
}

yields

public StringConcatenation foo() {
    StringConcatenation _xblockexpression = null;
    {new StringBuilderBasedAppendable(null) <<-- error is here
      StringConcatenation builder = new StringConcatenation();
      builder.newLine();
      _xblockexpression = (builder);
    }
    return _xblockexpression;
}
Comment 1 Sebastian Zarnekow CLA 2011-03-29 11:23:14 EDT
Another example:

compile(Entity e) { 
  val body = body(e);
  '''
  «body»
  '''
}

body(Entity e) {}


public StringConcatenation compile(final Entity e) {
    StringConcatenation _xblockexpression = null;
    {
      _this.body(e);
      final void body = null; <<-- error is here
      StringConcatenation builder = new StringConcatenation();
      builder.newLine();
      builder.append(null, "");
      builder.newLineIfNotEmpty();
      _xblockexpression = (builder);
    }
    return _xblockexpression;
  }
  
public void body(final Entity e, final ImportManager importManager) {
}
Comment 2 Sven Efftinge CLA 2011-04-01 11:07:54 EDT
pushed to master
Comment 3 Karsten Thoms CLA 2017-09-19 17:25:05 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 4 Karsten Thoms CLA 2017-09-19 17:36:45 EDT
Closing all bugs that were set to RESOLVED before Neon.0