[Fwd: compiling errors with latest gcc 4.4 and AWT/Swing]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



FYI, Classpath people.  Please help!
--- Begin Message ---
Hi All,

I was recently trying to run a java project, developed for and run
with Sun's java, with the gcc compiler instead. When I first installed
the gcj available from the Ubuntu repository, I ran into compilation
erros and then realised that the version shipped on the repos was
relatively old  (4.2.4) so I decided to upgrade it to the latest one,
hoping that these compilation issues will get resolved.

With great help from this forum, I got the newest GCC running on my
machine with the following commands:

$ svn co http://gcc.gnu.org/svn/gcc/branches/gcc-4_4-branch/
$ mkdir gcc-4_4-branch/obj-x86_64-unknown-linux-gnu
$ cd gcc-4_4-branch/obj-x86_64-unknown-linux-gnu
$ `pwd`/../configure --enable-languages=java
--prefix=/local/gcc-4_4-branch/install --enable-java-home
--enable-java-awt=gtk
$ make && make install
$ /local/gcc-4_4-branch/install/lib/jvm/bin/java -version java version
"1.5.0" gij (GNU libgcj) version 4.4.0 20090330 (prerelease)

Using Eclipse, I linked my project to the newly installed JRE
(JRE home directory on '/local/gcc-4_4-branch/install/lib/jvm' ; JRE
system libraries on
'/local/gcc-4_4-branch/install/share/java/libgcj-4.4.0.jar' and the
sourcefile on '~/gcc-4_4-branch/libjava/classpath' )

When I try ro tun the project (from Eclipse), I ran into exactly the
same compilation errors as encountered with the older gcc version:

Exception in thread "main" java.lang.IllegalArgumentException
   at javax.swing.ScrollPaneLayout.addLayoutComponent(ScrollPaneLayout.java:148)
   at java.awt.Container.addImpl(Container.java:392)
   at java.awt.Container.add(Container.java:230)
   at nl.kbna.dioscuri.GUI.setScreen(GUI.java:512)
   at nl.kbna.dioscuri.GUI.<init>(GUI.java:256)
   at nl.kbna.dioscuri.GUI.<init>(GUI.java:295)
   at nl.kbna.dioscuri.GUI.main(GUI.java:213)

The problem seem to lie with AWT and Swing... and by digging deeper
into the code I found that:

In GUI.java the following call is made:
	screenPane.add(screen);
This works using Sun's Java, but causes a IllegalArgumentException in
GCJ and the reason seems to be as follows:

GCJ java.awt.Container class on line 276 contains code for the above call:
	add(Component comp)
	{
		addImpl(comp, null, -1)
	}

The addImpl function calls, near the end (line 390):
	layoutMgr.addLayoutComponent("", comp);
because it was passed null constraints.

The ScrollPaneLayout class implements the addLayoutComp (line 125):
	addLayoutComponent(String key, Component component)
but notice that the 'key' variable has been passed an empty String;
this function now throws an IllegalArgumentException.

.... As anyone had this sort of problem ? Any idea how to fix it ?

Regards

David Michel

--- End Message ---

[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux