-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
6u10, 7
-
x86
-
windows_xp, windows_7
FULL PRODUCT VERSION :
java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Section 7.5.3 of the JLS Third Edition states: "if a compilation unit contains both a single-static-import (§7.5.3) declaration that imports a type whose simple name is n, and a single-type-import declaration (§7.5.1) that imports a type whose simple name is n, a compile-time error occurs. "
The compiler accepts this though, if both n are the same type. Either the documentation need clarification or this is a compiler bug.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Possibly there should be a compiler error. If not, the JLS documentation should be clarified.
ACTUAL -
No compiler error.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import static java.util.Map.Entry;
import java.util.Map.Entry;
public class ImportBug {
}
---------- END SOURCE ----------
java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Section 7.5.3 of the JLS Third Edition states: "if a compilation unit contains both a single-static-import (§7.5.3) declaration that imports a type whose simple name is n, and a single-type-import declaration (§7.5.1) that imports a type whose simple name is n, a compile-time error occurs. "
The compiler accepts this though, if both n are the same type. Either the documentation need clarification or this is a compiler bug.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Possibly there should be a compiler error. If not, the JLS documentation should be clarified.
ACTUAL -
No compiler error.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import static java.util.Map.Entry;
import java.util.Map.Entry;
public class ImportBug {
}
---------- END SOURCE ----------
- duplicates
-
JDK-7184882 Single static import and single type import collision not reported
- Closed