Re: [Jastadd] [bug report] absence of AbstractWildcardType.createQualifiedAccess()

From: Na, Hyunik <>
Date: Thu, 3 May 2012 09:30:39 +0900

Hello Jesper,


Testing using your program and script does not produce the same result as my

( It produces new error messages and NullPointer exceptions. )


In addition, it runs so fast that it is rather doubtful that it runs

( it took only 20 seconds on my computer, but running

           java … JavaCompiler … _at_files

, that is compiling all the java files in a single invocation of the
JastAddJ compiler, took over 7 minutes.

Of course, my script is a lot slower: It took about an hour and 40 minutes.


Indeed, many messages look as if nothing is done.

For example, more than half of the messages look like:


### compiling

### result = 0, compiled

### compiling

### result = 0, compiled

### compiling

### result = 0, compiled


( Why isn’t there even a single “Loading .java file: …” message for each
test case? )


I thought about the reason of this difference.

I guess that the cause might be the static fields of the classes of

Each invocation of JavaCompiler.compile() in your script might not be run in
a completely “fresh” state of the compiler,

because some classes have static fields.

So, each invocation of JavaCompiler.compile() might be affected by earlier

and the compiler might run into a state which is unreachable from a normal

( This is just a “guess”. I didn’t verify it. )


On the other hand, the results of “java … JavaCompiler … _at_files” and my
script coincide.


- Hyunik


From: Jesper qvist []
Sent: Wednesday, May 02, 2012 12:53 AM
To: Na, Hyunik
Subject: Re: [Jastadd] [bug report] absence of


Hello Hyunik,

First of all thank you for the information! I should now be able to
reproduce your build conditions and also the original error.

Building OpenJDK seems to be a very useful test for JastAddJ. More bugs
found is a good thing, that means we can try to fix them!

I noticed that the build script you use is a bit slow. The reason is that
the JVM is restarted for each source file that is compiled. Considering the
large number of source files (7819 in openjdk-6-b24), you get a large
overhead for starting/stopping the host JVM (especially if you use a server

On 04/26/2012 04:02 AM, Na, Hyunik wrote:

rm -rf ./build/*

for i in $(find . -name *.java)


  echo "### compiling $i"

  java -cp $HOME/install/JastAddJ/Java1.5Backend JavaCompiler -verbose
-bootclasspath .:./build:$Openjdk16/build/linux-i586/classes -extdirs .
-classpath . -d build $i

  echo "### result = $?, compiled $i"



So if you want to build this faster, you could try to use the following
program I wrote. It seems to have sped up the build for me:
import java.util.*;

public class BatchCompiler {

    public static void main(String[] args) {

        int fileList = -1;

        for (int i = 0; i < args.length; ++i) {
            if (args[i].startsWith("_at_")) {
                fileList = i;

        if (fileList == -1) {
            System.err.println("No file list argument found!");

        String[] compileArgs = new String[args.length];
        for (int i = 0; i < args.length; ++i) {
            if (i > fileList) {
                compileArgs[i-1] = args[i];
            } else {
                compileArgs[i] = args[i];

        try {
            Scanner scanner = new Scanner(new FileInputStream(

            while (scanner.hasNextLine()) {
                String fileName = scanner.nextLine();
                compileArgs[args.length-1] = fileName;
                System.out.println("### compiling " + fileName);
                boolean result = false;
                try {
                    result = JavaCompiler.compile(compileArgs);
                } catch (Throwable t) {
                System.out.println("### result = " +
                        (result ? 0 : 1) + ", compiled " + fileName);
        } catch (IOException e) {
            System.err.println("Batch compile aborted!");


BatchCompiler simply invokes JastAddJ once for each line in the supplied
argument file, with the same command line arguments (except the argument
file option - it's difficult to explain this, hopefully my code is

I modified your build script to compile and invoke BatchCompiler:



echo "Preparing JastAddJ"
ant -f $JASTADDJ/Java1.5Backend/build.xml

find . -name '*.java' | grep -v 'BatchCompiler\.java' > files

rm -rf build
mkdir build

javac -cp $JASTADDJ/Java1.5Backend
java -cp .:$JASTADDJ/Java1.5Backend BatchCompiler -verbose \
-bootclasspath .:./build:OPENJDK6/build/linux-amd64/classes \
-extdirs . -classpath . -d build _at_files 2>&1 | tee output.txt

It seems to compile the Java files much faster. Your results may vary.

Received on Thu May 03 2012 - 02:30:48 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 16 2014 - 17:19:06 CEST