Bug 27852 - We should not reject a class named java if it is in the unnamed package
Summary: We should not reject a class named java if it is in the unnamed package
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-06 12:28 EST by Olivier Thomann CLA
Modified: 2002-12-18 04:38 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.