GCJ is Dangerously Buggy
By Angsuman Chakraborty, Gaea News NetworkWednesday, June 13, 2007
GCJ 1.4.2 which was forcefully bundled with Fedora Core 6 (and has been updated from their repository to the latest available version) must not be used with any enterprise product, nay for any Java project at all. I know it is being used in OpenOffice, which I think is a serious mistake. It is dangerously buggy and needs tons of testing even for hobbyist usage. Let me explain why.
Initializing Date class with no arguments gives the current Date. This is a very basic functionality which has been since 0.5 beta version of Java. Let me give a simple example:
public class TestDate {
public static void main(String args[]) {
System.out.println("The current date is: " + new java.util.Date());
}
}
This when compiled and run on GCJ 1.4.2 gives May 24th 2007 instead of the current date June 13th 2007! Even the time and locale information is totally incorrect. The JDK results are fully in sync with the Gnome display as also with date output from console as is to be expected. I have no idea where GCJ gets the date value from. I found this problem in a JSP code running on Tomcat which unfortunately has been configured by Fedora to run with GCJ.
I have tested it on two machines with vastly differing hardware but with same results. I couldn’t believe my eyes. Check it for yourself:
[angsuman@jaguar ~]$ /etc/alternatives/java_sdk/bin/java -version && /etc/alternatives/java_sdk/bin/javac TestDate.java && /etc/alternatives/java_sdk/bin/java TestDate
java version “1.4.2″
gij (GNU libgcj) version 4.1.1 20070105 (Red Hat 4.1.1-51)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The current date is: Thu May 24 15:04:07 GMT-`1:47 2007
[angsuman@jaguar ~]$ java -version && javac TestDate.java && java TestDate
java version “1.6.0_01″
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Server VM (build 1.6.0_01-b06, mixed mode)
The current date is: Wed Jun 13 22:21:56 IST 2007
Note: The above is raw output from my machine.
Any JVM which cannot even correctly give the date isn’t worth a dime in book, let alone be a JDK replacement. Not to mention this piece of $%^& doesn’t support generics or other JDK 5 & 6 features. I would strongly suggest any Linux user to stay away from GCJ. What GCJ implements is simply not Java; it is hazardous for your programming health and reputation, not to mention Java’s reputation.
Tags: Eyes, JSP, Why
August 30, 2007: 3:15 pm
J’ai r�p�t� le test avec une kubuntu; voici mes r�sultats: Copyright (C) 2006 Free Software Foundation, Inc. java: Pour mes tests avec gcj, je n’ai pas utilis� l’encapsulation de gcj � la sauce java, mais les commandes gcj et gij. Ma version de gcj est plus ancienne que celle indiqu�e dans votre test. Avant de descendre en fl�che un logiciel, soumettez vos tests aux avis des autres utilisateurs; la communaut� des logiciels libres fonctionne gr�ce aux rapports de bugs; en avez-vous soumis un pour gcj? |
Jack Tanner