-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
b37
-
generic
-
generic
-
Verified
Name: izR10247 Date: 01/20/2004
1.5.0-beta b33 compiler generates incorrect
error message while it tries to compile source
which contains ambiguous static import of the different
static fields with the same names. This message states
that static member is already defined in a single-type import
declaration whereas there are no such declarations in the
source. This bug is revealed by the following
JCK 1.5 lang test:
lang/PKGS/pkgs057/pkgs05702.html
To reproduce this bug please run following test using
script below, note that b32a compiler also contains
this bug:
================= MyTest.sh begin =====================
#!/usr/bin/bash
set -x
uname -a
JAVAC=/export/ld25/java/dest/jdk1.5.0-b33/solaris-sparc/bin/javac
$JAVAC -version -source 1.5 -d . p1/A1.java
$JAVAC -version -source 1.5 -d . p2/A2.java
$JAVAC -version -source 1.5 -d . MyTest.java
================= MyTest.sh end =======================
================= MyTest.java begin ===================
package p;
import static p1.A1.f;
import static p2.A2.f;
public class MyTest {
public static void main(String argv[]) {
f = 1;
}
}
================= MyTest.java end =====================
================= A1.java begin =======================
package p1;
public class A1 {
static public int f = 6;
}
================= A1.java end =========================
================= A2.java begin =======================
package p2;
public class A2 {
static public int f = 6;
}
================= A2.java end =========================
================= MyTest output begin =================
+ uname -a
SunOS novo148 5.8 Generic_108528-20 sun4u sparc SUNW,Ultra-80
+ JAVAC=/export/ld25/java/dest/jdk1.5.0-b33/solaris-sparc/bin/javac
+ /export/ld25/java/dest/jdk1.5.0-b33/solaris-sparc/bin/javac -version -source 1.5 -d . p1/A1.java
javac 1.5.0-beta2
+ /export/ld25/java/dest/jdk1.5.0-b33/solaris-sparc/bin/javac -version -source 1.5 -d . p2/A2.java
javac 1.5.0-beta2
+ /export/ld25/java/dest/jdk1.5.0-b33/solaris-sparc/bin/javac -version -source 1.5 -d . MyTest.java
javac 1.5.0-beta2
__input:3: f is already defined in a single-type import
(source unavailable)
1 error
================= MyTest output end ===================
======================================================================
###@###.### 10/25/04 22:53 GMT
1.5.0-beta b33 compiler generates incorrect
error message while it tries to compile source
which contains ambiguous static import of the different
static fields with the same names. This message states
that static member is already defined in a single-type import
declaration whereas there are no such declarations in the
source. This bug is revealed by the following
JCK 1.5 lang test:
lang/PKGS/pkgs057/pkgs05702.html
To reproduce this bug please run following test using
script below, note that b32a compiler also contains
this bug:
================= MyTest.sh begin =====================
#!/usr/bin/bash
set -x
uname -a
JAVAC=/export/ld25/java/dest/jdk1.5.0-b33/solaris-sparc/bin/javac
$JAVAC -version -source 1.5 -d . p1/A1.java
$JAVAC -version -source 1.5 -d . p2/A2.java
$JAVAC -version -source 1.5 -d . MyTest.java
================= MyTest.sh end =======================
================= MyTest.java begin ===================
package p;
import static p1.A1.f;
import static p2.A2.f;
public class MyTest {
public static void main(String argv[]) {
f = 1;
}
}
================= MyTest.java end =====================
================= A1.java begin =======================
package p1;
public class A1 {
static public int f = 6;
}
================= A1.java end =========================
================= A2.java begin =======================
package p2;
public class A2 {
static public int f = 6;
}
================= A2.java end =========================
================= MyTest output begin =================
+ uname -a
SunOS novo148 5.8 Generic_108528-20 sun4u sparc SUNW,Ultra-80
+ JAVAC=/export/ld25/java/dest/jdk1.5.0-b33/solaris-sparc/bin/javac
+ /export/ld25/java/dest/jdk1.5.0-b33/solaris-sparc/bin/javac -version -source 1.5 -d . p1/A1.java
javac 1.5.0-beta2
+ /export/ld25/java/dest/jdk1.5.0-b33/solaris-sparc/bin/javac -version -source 1.5 -d . p2/A2.java
javac 1.5.0-beta2
+ /export/ld25/java/dest/jdk1.5.0-b33/solaris-sparc/bin/javac -version -source 1.5 -d . MyTest.java
javac 1.5.0-beta2
__input:3: f is already defined in a single-type import
(source unavailable)
1 error
================= MyTest output end ===================
======================================================================
###@###.### 10/25/04 22:53 GMT
- relates to
-
JDK-6260444 javac sometimes does not use source when it is available
-
- Closed
-