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

Bug 352871

Summary: Implementation of CompilationUnitProviderAspect.findExtension is wrong
Product: [Tools] AJDT Reporter: Mirco Dotta <mirco.dotta>
Component: CoreAssignee: AJDT-inbox <AJDT-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: andrew.eisenberg
Version: unspecified   
Target Milestone: 2.2.0   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Mirco Dotta CLA 2011-07-22 10:38:33 EDT
Build Identifier: M20110210-1200

Within the Eclipse Scala-IDE we have experienced the following issue:

When a file is named X.Y.scala the wrong editor is opened. After 3h debugging I was able to track this down and CompilationUnitProviderAspect.aj is on blame for this. This aspect class intercepts the creation of the CompilationUnitProvider and in the constructor calls the method `findExtension`, which is not correctly implemented. 

The first line:
int extensionIndex = name.indexOf('.') + 1;

is wrong, it should be 
int extensionIndex = name.lastIndexOf('.') + 1;

The following is the bug that we have on our assembla tracker that is linked to the above described problem:
https://scala-ide-portfolio.assembla.com/spaces/scala-ide/tickets/1000434-more-than-one-dot-in-the-filename-cause-the-file-to-be-seen-as-java

It would be really good if you could report us when this is fixed, so that we can upgrade the lib. In the meanwhile, I'll be looking for a workaround, if you have any suggestion, please let me know.

Reproducible: Always
Comment 1 Andrew Eisenberg CLA 2011-07-22 11:40:44 EDT
That sounds like a reasonable fix to me.  I have never come across a compilation unit name with more than one '.' in it.  Is this a common thing in Scala?

I'll fix it and get a new build out.
Comment 2 Mirco Dotta CLA 2011-07-22 11:45:24 EDT
Wow, that was fast! :)

No, in scala is not at all common, but it's a Play! (web framework with a scala front-end) convetion. Thanks a ton for the quick fix.
Comment 3 Andrew Eisenberg CLA 2011-07-22 11:53:44 EDT
Fix has been committed on the 3.6 and 3.7 streams.  I made the change to CompilationUnitProviderAspect.findExtension as well as CompilationUnitProviderAspect.trimName.

The builds should be out in an hour or two.  Please let me know if this fixes your problem and I will close this issue.
Comment 4 Andrew Eisenberg CLA 2011-07-22 16:32:52 EDT
Now available on the 3.7 stream.  3.6 stream is forthcoming.
Comment 5 Mirco Dotta CLA 2011-07-23 07:48:45 EDT
I cannot find the link to the AJDT build server, the one in the home page is broken. Could you please point me to it (3.6 streaming)
Comment 6 Andrew Eisenberg CLA 2011-11-07 14:35:56 EST
3.6 update site is here:
http://download.eclipse.org/tools/ajdt/36/dev/update

What is the broken url that you found?