Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347612 - Classes with name with '$' and conflicting are not reported
Summary: Classes with name with '$' and conflicting are not reported
Status: VERIFIED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.8 M7   Edit
Assignee: Jay Arthanareeswaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-30 05:20 EDT by Jay Arthanareeswaran CLA
Modified: 2012-04-30 01:24 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jay Arthanareeswaran CLA 2011-05-30 05:20:19 EDT
Create two classes with following content into two different compilation units.

package p;
public class Name$ABC
{
	class ABC {} 
}  

----

package p;
public class Name
{
	class ABC{} 
} 

-----

The following error should be reported: "The type Name$ABC is already defined" but not. However, after a clean + build, the error appears. Modify (and save) either of the files, the error goes away.
Comment 1 Ayushman Jain CLA 2011-05-30 05:39:56 EDT
Even javac is confused here. It complains
class Name$ABC is public, should be declared in a file named Name$ABC.java
public class Name$ABC
       ^
1 error

Not sure what the error should be here, but it should not go away after cleaning. Jay, can you take a look (post 3.7)?
Comment 2 Jay Arthanareeswaran CLA 2011-05-30 06:28:43 EDT
You have to put them in two separate java files. When I do that, javac is always consistent with the following error:

Name.java:3: duplicate class: Name.ABC
        class ABC{}
        ^
1 error
Comment 3 Ayushman Jain CLA 2011-05-30 06:55:34 EDT
(In reply to comment #2)
> You have to put them in two separate java files. When I do that, javac is
> always consistent with the following error:

I also put them in 2 files, and I got the error in comment 1 (both java6 and 7). Javac isn't consistent across machines then ;)
I think we get the desired error after cleaning since both the files get build together, but when you just change one file and save, the Name$ABC class file is overwritten by the new class file.
Comment 4 Jay Arthanareeswaran CLA 2012-03-19 02:55:01 EDT
While it would be ideal to have this fixed, I don't know how this can ever be fixed for reconciliation. Hence closing it, since things work for clean+build.
Comment 5 Satyam Kandula CLA 2012-04-30 01:24:33 EDT
I agree that we don't have to fix this. 
Verified for 3.8M7