Bug 168208 - Renaming classes from lowercase to uppercase results in an error
Summary: Renaming classes from lowercase to uppercase results in an error
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 minor with 1 vote (vote)
Target Milestone: 3.3 RC1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-15 09:38 EST by Nathan Lawrence CLA
Modified: 2007-05-15 07:48 EDT (History)
2 users (show)

See Also:
Olivier_Thomann: review+


Attachments
Proposed patch (7.48 KB, patch)
2007-05-11 13:14 EDT, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Lawrence CLA 2006-12-15 09:38:49 EST
Build ID: M20060629-1905

Steps To Reproduce:
1. Create a java class in eclipse
2. Rename the class so that the only change is in the case of one or more letters

More information:
I believe that since windows file names are not case sensitive, eclipse is renaming the file to a name that windows thinks is the same, resulting in an error.  I circumvent the bug by changing the case and adding a letter, then changing the case again.
Comment 1 Jakub Jurkiewicz CLA 2007-02-05 07:52:56 EST
I cannot reproduce this error in Version: 3.3.0, Build id: I20060810-1230.
Comment 2 Jan Himmelspach CLA 2007-04-19 17:33:04 EDT
We experienced this problem as well (3.2.1). In a distributed project we crashed all installations which we all had to recover manually by cleaning everything afterward! Including our external project partners :-(
(We are using subversion, committed the renamed file, after refreshing the problem appeared on all installations - thus the workaround does not work)
Comment 3 Kim Horne CLA 2007-05-07 10:39:56 EDT
Passing to JDT for comment.
Comment 4 Martin Aeschlimann CLA 2007-05-07 10:56:20 EDT
Did you use refactor rename in the package explorer or normal rename in the navigator?
Comment 5 Jan Himmelspach CLA 2007-05-07 14:42:17 EDT
If I remember correctly: renamed in the code (an inner class).
Comitting and updating on other machines caused the failure there as well
Comment 6 Martin Aeschlimann CLA 2007-05-08 04:39:03 EDT
Renamed in the code using 'refactor rename', or just with typing and saving?
Can you check what's in the .log?
Comment 7 Jan Himmelspach CLA 2007-05-08 05:02:21 EDT
Cannot remember how I renamed the class. Most likely by typing in the code (renamed inner class only used within the outer class).

Entry in the log file:
!ENTRY org.eclipse.jdt.core 4 4 2007-04-10 10:49:21.281
!MESSAGE JavaBuilder handling CoreException
!STACK 1
org.eclipse.core.internal.resources.ResourceException: A resource exists with a different case: /core/bin/james/core/util/graph/trees/RedBlackTree$node.class.
	at org.eclipse.core.internal.resources.Resource.checkDoesNotExist(Resource.java:281)
	at org.eclipse.core.internal.resources.File.create(File.java:109)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.writeClassFileBytes(AbstractImageBuilder.java:671)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.writeClassFile(AbstractImageBuilder.java:651)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.acceptResult(AbstractImageBuilder.java:181)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:417)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:300)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:213)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:237)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:59)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:249)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:169)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:603)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:167)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:230)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:233)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:252)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:285)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:145)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:208)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
!SUBENTRY 1 org.eclipse.core.resources 4 275 2007-04-10 10:49:21.281
!MESSAGE A resource exists with a different case: /core/bin/james/core/util/graph/trees/RedBlackTree$node.class.
Comment 8 Martin Aeschlimann CLA 2007-05-08 05:18:00 EDT
Moving to jdt.core.
Comment 9 Kent Johnson CLA 2007-05-09 14:34:04 EDT
Please reopen with a reproduceable testcase.

I've tried all combinations I can think of & they work fine.

The walkback from comment #7 is from a full build & not a normal incremental build from a simple source change.
Comment 10 Jan Himmelspach CLA 2007-05-09 15:09:18 EDT
We made a full rebuild (after what I presented in Comment 7)! More than once - not relying on the internal compiler. Cleaned everything. By using Clean from the menu as well as deleting the compiled files from the disc. Nothing worked - at least for several "rebuild rounds". 
And it failed on more than one computer ...
Comment 11 Kent Johnson CLA 2007-05-09 15:20:51 EDT
What do you mean "not relying on the internal compiler" ?

Do you have any Ant scripts writing .class files to the output folder that could collide with your normal source files ?
Comment 12 Jan Himmelspach CLA 2007-05-09 15:57:03 EDT
Sorry - "not using" the incremental compilation. Cleaned everything (by menu and manually) - still using the internal compiler but on a a clear build path.

--- snip ---

Just checked it again: Renanmed the inner class Node to node (by using context menu refactoring on Node in the source editor). Afterwards cleaned and rebuilded everything by using the clean all projects.

The color of the error mark is red (but filled) - thus it seems as if the problem has been solved - but trying to execute something from the project terminates with "unresolved compilation problem".

Tried to reproduce the problem with a simple class but there everything seems to work.

The project the file the change has been applied to is pretty large - we have about 68 open projects in the IDE (whereby we had this problem as well on machines having less projects - around 10). All projects with enabled subclipse support. All projects are compiled into one build path (Thus "scrub output folders" is deactived) - that's the reason why I removed the class files manually - but this did not change anything. The sad thing is that we had the problem on other machines as well (update by external svn client, using refresh in eclipse afterward).

Here the error log entry of today:

eclipse.buildId=M20060629-1905
java.version=1.6.0-beta2
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Command-line arguments:  -os win32 -ws win32 -arch x86

Error
Wed May 09 21:31:05 CEST 2007
JavaBuilder handling CoreException

org.eclipse.core.internal.resources.ResourceException: A resource exists with a different case: /core/bin/james/core/util/graph/trees/RedBlackTree$Node.class.
at org.eclipse.core.internal.resources.Resource.checkDoesNotExist(Resource.java:281)
at org.eclipse.core.internal.resources.File.create(File.java:109)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.writeClassFileBytes(AbstractImageBuilder.java:671)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.writeClassFile(AbstractImageBuilder.java:651)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.acceptResult(AbstractImageBuilder.java:181)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:417)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:300)
at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:213)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:237)
at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:59)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:249)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:169)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:603)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:167)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:230)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:233)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:252)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:285)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:145)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:208)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

Comment 13 Kent Johnson CLA 2007-05-09 16:14:08 EDT
Then you really do have a .class file collision.

> "All projects are compiled into one build path"

If all of your projects are compiling into a single output folder & a full build after you've cleaned the output folder produces this error THEN you have a collision with this type.

Please look for all implementors RedBlackTree. I suspect you'll find more than one & they're both trying to define a member type named Node/node.
Comment 14 Jan Himmelspach CLA 2007-05-10 10:54:32 EDT
No - that's not true. There is only ONE implementor.

I was able to reproduce this behaviour in the meantime by defining a new project with an own build path (do not scrub output folder). Sadly I'm very short on time and have not directly written down the steps I have undertaken but if I remember them correctly: turning off scrub output folder and cleaning afterward caused the problem. Maybe Eclipse does not automatically remove generated class files of renamed files? Maybe because of "do not scrub"? 
Complete content of the one and only file of the project which is compiled into the default build path of a new project:

public class TstIt {

  private class Node {
    
  }
  
}

Thus it has definetly nothing to do with our project. It's just a reproducable and annoying Eclipse bug.
Comment 15 Kent Johnson CLA 2007-05-10 12:54:03 EDT
Reproduced with a simple case.

Do not need to do a Clean (which is a no-op if "Scrub output folders" is disabled).

And the test class can be a simple type such as: class Xx {} -> class XX {}
Comment 16 Kent Johnson CLA 2007-05-11 13:14:31 EDT
Created attachment 66908 [details]
Proposed patch
Comment 17 Kent Johnson CLA 2007-05-11 14:20:57 EDT
Released into HEAD for 3.3RC1

Added DependencyTests.testCaseInvariantType
Comment 18 Olivier Thomann CLA 2007-05-11 17:19:24 EDT
Patch looks good to me.
Comment 19 David Audel CLA 2007-05-15 07:48:24 EDT
Verified for 3.3RC1 using I20070515-0010