Saturday, July 07, 2007

jikes vs javac

In my last post Priyanshu made a comment, " have you tried jikes". So, decided to give a try.

jikes is something which converts .java file into .class file. Yes, it is javac but IBM product not a Sun product. And let me begin with jikes page on sourceforge.net :

"You may wonder why the world needs another Java compiler, considering that Sun provides javac free with its SDK. Jikes has five advantages that make it a valuable contribution to the Java community:".

Providing free things, softwares and codes is a big deal for IBM but never for Sun. So don't keep on singing this Open source contribution song all the time. Whole world know what IBM is giving free.

So, advantage(s)

No. 1 : jikes is a open source software.
And so javac is ! Didn't get the advantage.

No. 2: Strictly Java compatible - It is not providing any superset or subset variation support.

Good, but this little of strictness most of time increase the code line from thousands or so.

No. 3: High Performance: Compilation is faster than javac.

Who really bother about compilation, anyway you have to come again and run on java command. I guess world is ready to devote 2 more minute in compilation.

Anyway, I have compiled one of the .java file(one which i have used in the last post) on the most stable version of jikes:

jikes TestForJDB.java

Issued 5 system warnings:

*** Semantic Warning: The file "E:/Program Files/Java/jdk1.6.0/jre/lib/ext/" doe
s not exist or else is not a valid zip file.


*** Semantic Warning: The file "E:/Program Files/Java/jdk1.6.0/jre/lib/ext/" doe
s not exist or else is not a valid zip file.


*** Semantic Warning: The file "E:/Program Files/Java/jdk1.6.0/jre/lib/ext/" doe
s not exist or else is not a valid zip file.


*** Semantic Warning: The file "E:/Program Files/Java/jdk1.6.0/jre/lib/ext/" doe
s not exist or else is not a valid zip file.


*** Semantic Warning: The file "E:/Program Files/Java/jdk1.6.0/jre/lib/ext/" doe
s not exist or else is not a valid zip file.

Didn't get what this warning message is and really not why you show it to me 5 times.

Then I have tried to look into -version command.

javac -version

- javac 1.6.0

jikes -version

- Jikes Compiler - Version 1.22 - 3 October 2004
Copyright (C) IBM Corporation 1997-2003, 2004.
- Licensed Materials - Program Property of IBM - All Rights Reserved.
Originally written by Philippe Charles and David Shields of IBM Research,
Jikes is now maintained and refined by the Jikes Project at:

Please consult this URL for more information and for reporting problems.

Very informative :)). Originally written by ... what does that mean ?



No 4. jikes provides some cool feature like incremental build.

I didn't get anything out of it.

Look at this feature.

jikes ++ TestForJDB.java

// After the 5 warning message.

Incremental: Enter to continue or q + Enter to quit:

nothing changed...

Incremental: Enter to continue or q + Enter to quit: (this if you change the code)

ok...

Incremental: Enter to continue or q + Enter to quit:

nothing changed...


No 5. clear error message.

I have removed one semi-colon from the code at line no. 25. Look at the error message printed by two compilers:

javac TestForJDB.java

TestForJDB.java:25: ';' expected
stringJDB = value
^
1 error

jikes TestForJDB.java

Found 1 syntax error in "E:/Program Files/Java/jdk1.6.0/bin/TestForJDB.java":

25. stringJDB = value
^---------------^
*** Syntax Error: ";" inserted to complete BlockStatementsopt

Are you able to find out something extra ? By the way what was the meaning of BlockStatementsopt ?


I guess I made too many of negative statement :), Ok some good features are here:

- it is providing some additional options like

> jikes +Punused-package-imports TestForJDB.java - which at compilation time, will show you those import statement which are not in use.

> jikes +Pnaming-convention testForJDB.java - it will throw warning if you are not following the naming convention ( its really an idea of Sun, don't mind :) )


Again, I didn't like the verbose information(javac -verbose filename.java) . Where is the time information man... parsing time, total time to make class file... these are some of the cool use of verbose option. Showing only which all files you are reading is a useless information.

Anyway, nice to see one step ahead in the world of open source.

1 comment:

Waterfox said...

This is about Incremental Compilation. We use (have to use!!) Jdeveloper which has a cool feature. You can opt to rebuild only the classes which have changed since last build. Whole project need not be recompiled.
Now I think this feature is visibly useful in IDEs where u rebuild and it just checks what has changed and finishes it fast!
I will also use it :) But I use Dr.Java for retail compiling :D