-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.2.2
-
generic
-
generic
Name: laC46010 Date: 02/14/99
javac (1.1.x, 1.2fcs, 1.2.2) fails to compile cast expression with
class literal for any primitive type. If the class literal gets
parenthesized, compilation succeeds.
Test example and diagnostics follow:
-------------------------------------------------------
novo35% cat test.java
class test {
static Class c1 = (Class) Object.class; // Ok
static Class c2 = (Class) (int.class); // Ok
static Class c3 = (Class) int.class; // Fail
}
novo35% java -version
java version "1.2.2"
Classic VM (build JDK-1.2.2-E, green threads, sunwjit)
novo35% javac test.java
test.java:4: ';' expected.
static Class c3 = (Class) int.class; // Fail
^
test.java:4: Identifier expected.
static Class c3 = (Class) int.class; // Fail
^
test.java:4: Identifier expected.
static Class c3 = (Class) int.class; // Fail
^
3 errors
-------------------------------------------------------
======================================================================