Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332500 - Case insensitive imports not completely implemented
Summary: Case insensitive imports not completely implemented
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-14 04:50 EST by Mark Christiaens CLA
Modified: 2017-09-19 17:31 EDT (History)
3 users (show)

See Also:
sebastian.zarnekow: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Christiaens CLA 2010-12-14 04:50:07 EST
Build Identifier: I20101028-1441

Case insensitive imports don't seem to be fully supported yet.  For example in ImportScope.getLocalElements:

...
Function<IEObjectDescription, IEObjectDescription> aliaser = new Function<IEObjectDescription, IEObjectDescription>() {
	public IEObjectDescription apply(IEObjectDescription from) {
		final QualifiedName deresolved = normalizer.deresolve(from.getName());
		if (deresolved==null)
			throw new IllegalStateException("Couldn't deresolve "+from.getName()+" with import "+normalizer);
		return new AliasedEObjectDescription(deresolved, from, ignoreCase);
	}
};
...

The IllegalStateException is thrown.  It seems that the ImportNormalizer thinks it can handle the from.getName but then tries to deresolve with a namespace prefix with the wrong case.

Reproducible: Always
Comment 1 Mark Christiaens CLA 2011-01-24 03:49:09 EST
Maybe have a look also at ImportedNamespaceAwareLocalScopeProvider.getWildCard(). It returns by default a "*".  I think, after that, the "*" is not dealt with in a case-insensitive manner.  So if I override the getWildcard to return "all" (which is the wildcard in VHDL) then things seem to go wrong.
Comment 2 Sebastian Zarnekow CLA 2011-01-25 03:09:25 EST
Pushed to master.
Comment 3 Mark Christiaens CLA 2011-03-23 11:52:15 EDT
I think this bug needs a little more work.  When I do two consecutive imports that are identical except for the capitalization of the importedNamespacePrefix then the resulting ImportScopes are different.  That in turn results in linking warnings.  The culprit is:

@Override
	public boolean equals(Object obj) {
		if (this==obj)
			return true;
		if (obj==null)
			return false;
		if (obj instanceof ImportNormalizer) {
			ImportNormalizer other = (ImportNormalizer)obj;
			//TODO not ignore case aware
			return other.hasWildCard==hasWildCard &&
				other.ignoreCase==ignoreCase &&
				other.importedNamespacePrefix.equals(importedNamespacePrefix);
		}
		return false;
	}

The final "equals" should convert both the importedNamespacePrefixes to lower or upper case while comparing when dealing with case-insensitive imports.
Comment 4 Sebastian Zarnekow CLA 2011-03-29 08:17:32 EDT
Pushed to master
Comment 5 Karsten Thoms CLA 2017-09-19 17:20:13 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 6 Karsten Thoms CLA 2017-09-19 17:31:37 EDT
Closing all bugs that were set to RESOLVED before Neon.0