public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* compiling errors with latest gcc 4.4 and AWT/Swing
@ 2009-04-14  8:57 David Michel
  0 siblings, 0 replies; only message in thread
From: David Michel @ 2009-04-14  8:57 UTC (permalink / raw)
  To: java

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-14  8:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-14  8:57 compiling errors with latest gcc 4.4 and AWT/Swing David Michel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).