Bug 498168 - Class "Int" in implicit imports shadows primitive type "int" despite "ignoreCase=false" import normalizer
Summary: Class "Int" in implicit imports shadows primitive type "int" despite "ignoreC...
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.10.0   Edit
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-19 16:58 EDT by Davor Cubranic CLA
Modified: 2016-07-19 23:59 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Davor Cubranic CLA 2016-07-19 16:58:29 EDT
If there is a class or interface named "Int" in the package that is in the implicit import list, Xtext incorrectly interprets it as the match wherever in my model I have a JvmTypeReference property with value "int". This happens even though the import normalizer has "false" as the value of the "ignoreCase" parameter.

Code to reproduce is available on Github:
- core project: https://github.com/cubranic/org.example.domainmodel
- unit tests: https://github.com/cubranic/org.example.domainmodel.tests

With the interface "Int" present in org.example.domainmodel.lib (as in the current HEAD), several tests fail that have a loop "for (var int i = 0; ...)" because the generated code becomes "for (Int i = Integer.valueOf(0); ...)". This interface was introduced in the final commit of org.example.domainmodel repo, just rewind to "master^" to see all tests in org.example.domainmodel.tests pass.
Comment 1 Christian Dietrich CLA 2016-07-19 18:02:07 EDT
from abstracttypescope javadoc

A scope that provides access to {@link JvmType types}.
Case insensitivity is not supported. It's always the most outer scope.
Comment 2 Davor Cubranic CLA 2016-07-19 18:32:58 EDT
OK, so what is "the most outer scope" in this case? The ImplicitImportsScopeProvider#getImplicitImports is called with"ignoreCase=false", so all import normalizers it creates have the same too.

And more to the point, how do I ensure imports are case-sensitive? There is zero reason for them not to be in my language.
Comment 3 Christian Dietrich CLA 2016-07-19 23:59:33 EDT
As I said. It is a xbase problem independent from the import. So nothing you can do