JDK-8025157 : Source not preferred over bootclasspath causing build problems
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6u19
  • Priority: P2
  • Status: Closed
  • Resolution: Not an Issue
  • OS: linux
  • CPU: generic
  • Submitted: 2013-09-20
  • Updated: 2013-10-01
  • Resolved: 2013-10-01
Related Reports
Relates :  
Description
SHORT SUMMARY:
 .
The following may not be a bug but is a change in behavior between
JDK6_MAIN_LINUX.X64_100421.1.6.0.20.B03 and
JDK6_MAIN_LINUX.X64_111207.1.6.0.31.B02 that is causing build problems for
JAVAVM labels that until now have been using the former and are trying to
move to the latter.  So if it is not a bug, please explain how the
situation
in the test case could best be resolved to allow a build that encounters
such
a scenario to succeed.
 .
Let JDK6 refer to some JDK6 distribution with sources from it available.
.
Create directory SDIR (eg /tmp/s) containing copies of
.
java/lang/System.java
sun/nio/cs/StreamEncoder.java
.
from JDK6.  Modify this StreamEncoder.java to contain
.
public static void foo(){}
.
Modify this System.java to add the line
.
        sun.nio.cs.StreamEncoder.foo();
.
to some method, such as as the first line in initializeSystemClass.
.
Create BDIR/foo.jar (eg /tmp/foo.jar) containing
sun/nio/cs/StreamEncoder.class
extracted from JDK6's rt.jar.
.
Use touch -t to set the timestamp of SDIR/sun/nio/cs/StreamEncoder.java to
a
value earlier than that on StreamEncoder.class in foo.jar.
.
Create an empty directory CDIR (eg /tmp/c)
.
Let JDKH be the path to a JDK home based on
JDK6_MAIN_LINUX.X64_111207.1.6.0.31.B02
for example (until this label ages out)
.
/ade_autofs/ade_base/JDK6_MAIN_LINUX.X64.rdd/111207.1.6.0.31.B02/jdk6
.
Then
.
cd SDIR
JDKH/bin/javac -bootclasspath BDIR/foo.jar:JDKH/jre/lib/rt.jar -classpath .
-d CDIR java/lang/System.java
.
will result in
.
java/lang/System.java:....: cannot find symbol
symbol  : method foo()
location: class sun.nio.cs.StreamEncoder
        sun.nio.cs.StreamEncoder.foo();
.
whereas doing the same with JDKH set to a JDK home based on
JDK6_MAIN_LINUX.X64_100421.1.6.0.20.B03 (which no longer exists itself on
/ade_autofs but is still present for now in all RDBMS labels up to 120117
and
JAVAVM labels up to 120118, so ...) for example
 .
/ade_autofs/ade_base2/JAVAVM_MAIN_LINUX.X64.rdd/120118/jdk6
 .
 completes without error.
 .
Note that the behavior of getting the error did not start with
JDK6_MAIN_LINUX.X64_100421.1.6.0.20.B03 but actually holds for all JDK6
labels still present on /ade_autofs/ade_base, the earliest being
 /ade_autofs/ade_base/JDK6_MAIN_LINUX.X64.rdd/100930.1.6.0.21.B50
.
INDICATORS:
COUNTER INDICATORS:
TRIGGERS:
KNOWN WORKAROUND:
PRESENT SINCE:
HOW TO VERIFY:
NOTES FOR SE:
REGRESSION:
Comments
This error was exposed by a fix for 6725036 - javac incorrectly determined lastModifiedTime() for sources and classes in a zip file archive. Hence, in the example above, javac never used StreamEncoder.class from foo.jar and always recompiled it from SDIR sources. With 6725036 fix it uses StreamEncoder.class from foo.jar in the scenario above, which does not contain sun.nio.cs.StreamEncoder.foo().
01-10-2013