Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6638501
Votes 0
Synopsis Regression with Javac in JDK6 U4 b03?
Category java:compiler
Reported Against
Release Fixed 6u4(b12), 6-open(b04) (Bug ID:2158764) , 7(b25) (Bug ID:2160116)
State 10-Fix Delivered, bug
Priority: 2-High
Related Bugs 6584312 , 6638567
Submit Date 06-DEC-2007
Description
We have a tool wscompile in Application Server. wscompile tool generates some Java classes and compiles them.The generated classes use some api(let's say javax.xml.rpc.Service), which are in the classpath. The api classes are bundled in javaee.jar and j2ee.jar has reference to javaee.jar in the classpath manifest. Only j2ee.jar is set in the classpath of wscompile. 
Importantly, Javac fails to compile with JDK6 U4 b03 but works fine with U4 b02 saying it cant find the api classes.

Is there any change in b03 thats causing this problem?

I will try to attach a testcase soon, I am filing this to see if you can recollect any changes in this area so that we can decide on if we should ship App Server SDK.
Posted Date : 2007-12-06 18:08:44.0

I am attaching a testcase to show how Wscompile tool in jaxrpc calls Javac.
Set JAVA_HOME and run  "ant build" to see the issue.
Posted Date : 2007-12-06 22:51:15.0

By passing -DnonBatchMode, it worked.
Posted Date : 2007-12-06 23:20:01.0

A new standalone test is added and reproduces the problem.
If Javac is invoked multiple times, it happens
Posted Date : 2007-12-07 19:56:30.0
Work Around
Possible scenarios to reproduce this problem:
1. In the more common case, jarfile1 must have jarfile2 listed in its Class-Path manifest entry, with only jarfile1 listed on the classpath. 
Two compilations in the same JVM space require classes from the jar file listed in the Class-Path entry. 
You have two ant javac targets, the second requiring something loaded in the first, under the two conditions above. 


2.In the second (less common) case, jarfile1 must have jarfile2 listed in its Class-Path manifest entry, with only jarfile1 listed on the classpath. 

And your program calls javac (com.sun.tools.javac.Main.compile() ) twice. 

Workarounds are as follows: 
1. Put all the jar files explicitly on the classpath.
2. In the (more likely) case that ant is being used, such as with multiple build targets in ant, you can workaround by either forking the javac target in the build.xml file or by putting both jar files on the classpath. 

3. If the compiler is called twice from one piece of code (for example, the application itself created compiler objects and called com.sun.tools.javac), you would pass the -DnonBatchMode option to the compiler.
Evaluation
There were changes in the way zip files are cached in javac. This changes are performance improvements.
There are few flags disabling these optimizations partially.
Add the -DnonBatchMode to the command line invokind the VM running the compiler.
If this doesn't solve the problem add an extra flag -DcheckZipIndexTimestamp.
If these two flags dont help add a third flag -DuseJavaUtilZip
Posted Date : 2007-12-06 22:17:18.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang