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

Bug 342032

Summary: [Xtend] Shodowing "this" in dispatch produces incorrect code
Product: [Modeling] TMF Reporter: Robert von Massow <rvonmassow>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow, sven.efftinge
Version: 2.0.0Flags: sven.efftinge: indigo+
Target Milestone: M7   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 341753    
Bug Blocks:    

Description Robert von Massow CLA 2011-04-06 10:38:48 EDT
Build Identifier: 

Having the two dispatch functions

dispatch genPlainText(TextPart this){
}
dispatch genPlainText(TextOrMarkup this)
}

the following Java code is produced:

  public Object _genPlainText(final TextOrMarkup _this) {
    return null;
  }
  
  public Object _genPlainText(final TextPart _this) {
    return null;
  }

  public Object genPlainText(final EObject _this) {
    if ((this instanceof TextOrMarkup)) {
      return _genPlainText((TextOrMarkup)this);
    } else if ((this instanceof TextPart)) {
      return _genPlainText((TextPart)this);
    } else {
      throw new IllegalArgumentException();
    }
  }

The argument to genPlainText is never used in the method itself, instead this is used. Calling the dispatch function will always result in an illegal argument exception.

Reproducible: Always
Comment 1 Sven Efftinge CLA 2011-04-07 04:05:22 EDT
pushed to master
Comment 2 Karsten Thoms CLA 2017-09-19 17:00:42 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 17:12:04 EDT
Closing all bugs that were set to RESOLVED before Neon.0