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

Bug 342107

Summary: [Xtend] Add error check for variable name shadowing
Product: [Modeling] TMF Reporter: Sven Efftinge <sven.efftinge>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 Flags: sven.efftinge: indigo+
Version: 2.0.0   
Target Milestone: M7   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sven Efftinge CLA 2011-04-07 03:21:55 EDT
Xtend supports shadowing of variable names.
This is useful and convenient in some situations. Mostly i the case, where you want to rebind 'this' in order to access properties of that variable in a convenient way.

toJava(Entity this) '''
   <<packageName>>

   public class <<name>> {
   }

'''

However the following is also possible but is usually unwanted:

foo(String foo) {
   val foo = 'other'
}
Comment 1 Sven Efftinge CLA 2011-04-19 08:02:53 EDT
We've decided to not support the shadowing of 'this', which turned out to be the only sensible use-case for variable shadowing. So we should disallow variable name shadowing alltogether.
Comment 2 Sven Efftinge CLA 2011-04-20 05:51:04 EDT
pushed to master
Comment 3 Karsten Thoms CLA 2017-09-19 17:40:41 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 4 Karsten Thoms CLA 2017-09-19 17:51:49 EDT
Closing all bugs that were set to RESOLVED before Neon.0