Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358116 - [Xtend] No error on duplicate variable names
Summary: [Xtend] No error on duplicate variable names
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.1.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-19 09:32 EDT by Benjamin Schwertfeger CLA
Modified: 2017-09-19 18:00 EDT (History)
2 users (show)

See Also:
sven.efftinge: indigo+


Attachments
Patch for JavaValidator and Testcase (2.31 KB, patch)
2011-09-19 09:36 EDT, Benjamin Schwertfeger CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Schwertfeger CLA 2011-09-19 09:32:56 EDT
It is possible to define two class variables with the same name:

@Inject String cache
@Inject Integer cache
@Inject Object cache

Leads to one String variable cache and cache_1 and cache_2 in java code. In xtend the type of cache is also String and you can not access the last two.

There should be a check for duplicate variable names inside a class.
Comment 1 Benjamin Schwertfeger CLA 2011-09-19 09:36:46 EDT
Created attachment 203588 [details]
Patch for JavaValidator and Testcase

Added new Validation method for this case.
Comment 2 Sven Efftinge CLA 2011-09-26 03:06:49 EDT
In the long run we should define all these Java-based constraints on the JvmModel, so they will automatically get applied for any Xbase-based language
Comment 3 Jan Koehnlein CLA 2011-10-17 05:41:42 EDT
Pushed to MASTER.

Validation is performed on the Xtend level.

Patch was not used, but thanks for your effort.
Comment 4 Jan Koehnlein CLA 2011-10-17 05:45:47 EDT
Jvm model validation will be handled in separate bug #361114
Comment 5 Karsten Thoms CLA 2017-09-19 17:49:25 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 6 Karsten Thoms CLA 2017-09-19 18:00:27 EDT
Closing all bugs that were set to RESOLVED before Neon.0