Bug 27852

Summary: We should not reject a class named java if it is in the unnamed package
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Olivier Thomann CLA 2002-12-06 12:28:59 EST
Using latest compiler code, we reject the following code:

class java {}

Javac 1.4.1 and jikes 1.18 accept it. You can even define the following code:
in java.java:
[public class java {
	public static int lang = 3;	
}]

in X.java:
[class X {
	static int i = java.lang;
}]

It compiles without a problem. Only Javac 1.2.2 fails compiling this code.

We fail with the errors:
1. ERROR in D:\temp\X.java (at line 3)
	static int i = java.lang;
	               ^^^^^^^^^
java.lang cannot be resolved or is not a type
----------
----------
2. ERROR in d:\temp\java.java (at line 1)
	public class java {
	             ^^^^
The type java collides with a package
Comment 1 Kent Johnson CLA 2002-12-10 11:31:13 EST
Fixed.
Comment 2 David Audel CLA 2002-12-18 04:38:32 EST
Verified.