Skip to main content

JavaFX 1.2: still a nasty compiler (NetBeans?) bug for Mobile

Posted by fabriziogiudici on June 4, 2009 at 5:50 AM PDT

A few days ago I discovered a nasty bug with the JavaFX compiler (or NetBeans? or both?) that prevents you from splitting a large project in sub-projects; see item #4 in my post at DZone. I hoped that the bug went away with JavaFX 1.2, but unfortunately it didn't. So I set up a simple test case. You can check it out from here:

svn co -r 40 https://kenai.com/svn/javafxstuff~svn/trunk/ModuleTest

There are two simple projects, Library and Project. Project declares Library as a dependency, thus includes the .jar delivered by Library in the compiler path. Library contains this simple class:

package it.tidalwave.javafxstuff.module.library;

public class LibraryClass
  {
    public var attr = "FooBar";
  }

while Project contains:

package it.tidalwave.javafxstuff.module.project;

import it.tidalwave.javafxstuff.module.library.LibraryClass;

public class ProjectClass
  {
    def xxx = LibraryClass { attr: "BarFoo" };
  }

For the record, Library also contains a Dummy class that is required by NetBeans since for the IDE every JavaFX project must have a main. No big trouble.

Now, if you compile Project setting for both projects the "Standalone" profile, everything goes fine. If you select the "Mobile" profile, the compiler fails with:

compile:
jar:
/home/fritz/Business/Tidalwave/Projects/JavaFXStuff/trunk/ModuleTest/Project/src/it/tidalwave/javafxstuff/module/project/ProjectClass.fx:17: cannot find symbol
symbol  : variable attr
location: class it.tidalwave.javafxstuff.module.library.LibraryClass
    def xxx = LibraryClass { attr: "BarFoo" };
1 error
ERROR: javafxc execution failed, exit code: 1
/home/fritz/Business/Tidalwave/Projects/JavaFXStuff/trunk/ModuleTest/Project/nbproject/build-impl.xml:145: exec returned: 255
BUILD FAILED (total time: 2 seconds)

That is, Project can see classes from Library, but can't see their (public) attributes. I discovered the bug with JavaFX 1.1 (necessarily on Windows for having the Mobile profile), but I can reproduce it on Linux and JavaFX 1.2 (with this combination you cannot run the Mobile emulator, but the compiler should work).

This, of course, completely jeopardizes the capability of partitioning a large project in smaller components, at least for the Mobile profile. For me it's really a critical bug.

Comments

And filed http://www.netbeans.org/issues/show_bug.cgi?id=166689

BTW, back to the original topic, the bug I was talking of is this: http://javafx-jira.kenai.com/browse/JFXC-2770

Humm... well, it makes sense that the Designer Tool does everything, but if it's not integrated to some IDE, no good for me. I am expecting something in the lines of Matisse, just one click away from my normal coding workflow.

I agree; in fact there was a "palette" full of items and I believe there were also regular things such as buttons and such.

@opinali: I assume the designer tool does mundane GUI as well, but Sun wanted to showcase the cooler-looking media stuff.

This is the reason why in my JavaFX Balls program, I keep two completely separated projects for desktop and mobile, even though a single class is different. The NetBeans plugin is indeed far from the maturity one would expect for real world production. Hopefully this will improve when Sun releases an updated JavaFX plugin for NetBeans 6.7 (the 6.7RC1 release doesn't support JavaFX at all). I was also expecting a visual SceneGraph composer for JavaFX (something in the lines of ReportMill's JFXBulder). If that stuff is not even being demoed in early access stage at JavaOne, it's bad news. The new control package and charts and layouts etc are great, but I don't want to write pages of code just to put together a form; this is so... pre-Matisse. ;-) Notice I'm not talking about the new designer tool that Sun was showing, that tool is targeted at media assets, but we also need a simple, IDE-integrated, visual designer for more mundane GUIs.

Finished a round of tests, exactly the same behaviour on Mac OS X, Linux, Windows XP.