Name: bsC130419 Date: 08/14/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
Note that this is not a duplicate of 4489318 (Review ID: 129527).
That was a bug report against JDK1.3.1 and that bug is solved in 1.4beta,
this is a new one against 1.4beta with another test-case which exposes a very
similar bug.
When you have a class B which has a static inner class C and you have
another "normal" class C, this second class C can sometimes not be
found.
To reproduce the problem:
mkdir bug
cd bug
mkdir src
mkdir src/x
mkdir src/y
mkdir classes
-------------------
-- src/x/B.java:
package x;
import x.*;
public class B {
public static class C {}
}
-------------------
-- src/x/C.java:
package x;
import x.*;
public class C {}
-------------------
-- src/y/Main.java:
package y;
class Main {
private R1 a;
private R2 b;
private R3 c;
}
-------------------
-- src/y/R1.java:
package y;
public final class R1 {
x.B.C a = null;
x.C b = null;
R2 c = new R2();
}
---------------------
-- src/y/R2.java:
package y;
public final class R2 {
x.B.C a = null;
x.C b = null;
}
----------------------
-- src/y/R3.java
package y;
public final class R3 {
x.B.C a = null;
x.C b = null;
R1 c = new R1();
}
-----------------------
Run the following, you will need to change the path to the compiler:
---------------------------------
#! /bin/sh -x
javac_cmd="/u/qmwanhj/j2sdk1.4.0/bin/javac -sourcepath .. -classpath
../../classes -d ../../classes -verbose"
rm -rf classes/*
(cd src/x; $javac_cmd B.java C.java)
echo
echo
(cd src/y; $javac_cmd Main.java)
echo
echo
sleep 1
# Here we modify the timestamp on R3.java to force a recompilation of
touch src/y/R3.java
sleep 1
echo
echo
# This compile fails.
(cd src/y; $javac_cmd Main.java)
---------------------------------------
You should get the following output:
javac_cmd=/u/qmwanhj/j2sdk1.4.0/bin/javac -sourcepath .. -classpath
../../classes -d ../../classes -verbose
+ rm -rf classes/x classes/y
+ cd src/x
+ /u/qmwanhj/j2sdk1.4.0/bin/javac -sourcepath .. -classpath ../../classes -d
../../classes -verbose B.java C.java
[parsing started B.java]
[parsing completed 328ms]
[parsing started C.java]
[parsing completed 2ms]
[checking x.B]
[loading /u/qmwanhj/j2sdk1.4.0/jre/lib/rt.jar(java/lang/Object.class)]
[wrote ../../classes/x/B$C.class]
[wrote ../../classes/x/B.class]
[checking x.C]
[wrote ../../classes/x/C.class]
[total 1277ms]
+ echo
+ echo
+ cd src/y
+ /u/qmwanhj/j2sdk1.4.0/bin/javac -sourcepath .. -classpath ../../classes -d
../../classes -verbose Main.java
[parsing started Main.java]
[parsing completed 345ms]
[loading /u/qmwanhj/j2sdk1.4.0/jre/lib/rt.jar(java/lang/Object.class)]
[loading ../y/R1.java]
[parsing started ../y/R1.java]
[parsing completed 4ms]
[loading ../../classes/x/B.class]
[loading ../../classes/x/B$C.class]
[loading ../../classes/x/C.class]
[loading ../y/R2.java]
[parsing started ../y/R2.java]
[parsing completed 3ms]
[loading ../y/R3.java]
[parsing started ../y/R3.java]
[parsing completed 3ms]
[checking y.Main]
[wrote ../../classes/y/Main.class]
[checking y.R1]
[wrote ../../classes/y/R1.class]
[checking y.R2]
[wrote ../../classes/y/R2.class]
[checking y.R3]
[wrote ../../classes/y/R3.class]
[total 1637ms]
+ echo
+ echo
+ sleep 1
+ touch src/y/R3.java
+ sleep 1
+ echo
+ echo
+ cd src/y
+ /u/qmwanhj/j2sdk1.4.0/bin/javac -sourcepath .. -classpath ../../classes -d
../../classes -verbose Main.java
[parsing started Main.java]
[parsing completed 345ms]
[loading /u/qmwanhj/j2sdk1.4.0/jre/lib/rt.jar(java/lang/Object.class)]
[loading ../../classes/y/R1.class]
[loading ../../classes/y/R2.class]
[loading ../y/R3.java]
[parsing started ../y/R3.java]
[parsing completed 7ms]
[loading ../../classes/x/B.class]
[loading ../../classes/x/B$C.class]
../y/R3.java:5: cannot resolve symbol
symbol : class C
location: package x
x.C b = null;
^
[checking y.Main]
[checking y.R3]
[total 1091ms]
1 error
(Review ID: 129966)
======================================================================