Bug 397501 - [xbase/Xtend][generator] Wrong class linked in generated code on name clash with java.lang
Summary: [xbase/Xtend][generator] Wrong class linked in generated code on name clash w...
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.3.1   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jan Koehnlein CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on: 409500
Blocks:
  Show dependency tree
 
Reported: 2013-01-05 05:59 EST by Jan Koehnlein CLA
Modified: 2018-06-11 02:58 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Koehnlein CLA 2013-01-05 05:59:11 EST
Given the dmodel

package foo {
  entity Foo{
    x:java.lang.Integer
  }
  entity Integer {}
}

the field x in the generated Java class will be of type "foo.Integer". Inspecting from the UI the linking seems to be correct in the model. The same scenario works in Xtend, so there must be something we haven't lifted up to Xbase yet.
Comment 1 Jan Koehnlein CLA 2013-01-05 06:19:17 EST
No, I was wrong, unfortunately the same holds for Xtend.
Comment 2 Sebastian Zarnekow CLA 2013-01-05 07:08:56 EST
That's because our code generator does / can not enumerate all classes from the same package to feed the import manager. We could query the index for classes like my.pack.NameFromJavaLang before we strip java.lang from the class reference, e.g ask for foo.Integer before we use Integer instead of java.lang.Integer. Do we have tests for cases here an inner type Integer is inherited?
Comment 3 Jan Koehnlein CLA 2013-01-05 08:53:09 EST
We need the same functionality in organize imports.

For the tests: I think we don't have them yet.
Comment 4 Christian Dietrich CLA 2018-06-11 02:58:55 EDT
https://github.com/eclipse/xtext-xtend/issues/439