-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
5.0
-
generic
-
generic
Name: izR10247 Date: 02/27/2004
Current 1.5.0-beta b40 compiler incorrectly compiles
java source which contains static import of static field
using non-canonical name. However Public Review Draft of
"Importing Static Members in the Javatm Programming Language"
in chapter "7.5.4 Static-Import-on-Demand Declarations" prohibits
this:
"A static-import-on-demand declaration allows all accessible (?6.6) static
members declared in the type named by a canonical name to be imported as
needed."
This bug causes failure of the following JCK 1.5 test:
lang/PKGS/pkgs052/pkgs05209/pkgs05209.html
To reproduce this bug please run following test using
script below, note that b39 compiler generates
error while tries to compile this test:
================= MyTest.sh begin =====================
#!/usr/bin/bash
set -x
uname -a
JDK=/export/ld25/java/dest/jdk1.5.0-b40/solaris-sparc
JAVAC=$JDK/bin/javac
JAVA=$JDK/bin/java
$JAVAC -version -source 1.5 -d . A.java B.java MyTest.java
$JAVA -showversion -cp . p.MyTest
================= MyTest.sh end =======================
================= MyTest.java begin ===================
package p;
import static p.B.*;
public class MyTest {
public static void main(String argv[]) {
System.out.println("Ok! f=" + f);
}
}
================= MyTest.java end =====================
================= A.java begin ========================
package p;
public class A {
public static int f = 8;
}
================= A.java end ==========================
================= B.java begin ========================
package p;
public class B extends A {
}
================= B.java end ==========================
================= MyTest output begin =================
+ uname -a
SunOS novo48 5.9 Generic_112233-08 sun4u sparc SUNW,Ultra-60
+ JDK=/export/ld25/java/dest/jdk1.5.0-b40/solaris-sparc
+ JAVAC=/export/ld25/java/dest/jdk1.5.0-b40/solaris-sparc/bin/javac
+ JAVA=/export/ld25/java/dest/jdk1.5.0-b40/solaris-sparc/bin/java
+ /export/ld25/java/dest/jdk1.5.0-b40/solaris-sparc/bin/javac -version
-source 1.5 -d . A.java B.java MyTest.java
javac 1.5.0-beta2
+ /export/ld25/java/dest/jdk1.5.0-b40/solaris-sparc/bin/java -showversion
-cp . p.MyTest
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b40)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b40, mixed mode)
Ok! f=8
================= MyTest output end ===================
======================================================================