Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342032 - [Xtend] Shodowing "this" in dispatch produces incorrect code
Summary: [Xtend] Shodowing "this" in dispatch produces incorrect code
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 341753
Blocks:
  Show dependency tree
 
Reported: 2011-04-06 10:38 EDT by Robert von Massow CLA
Modified: 2017-09-19 17:12 EDT (History)
2 users (show)

See Also:
sven.efftinge: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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