This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 133630 - Project is not compiled if java classes use fx classes
Summary: Project is not compiled if java classes use fx classes
Status: VERIFIED WONTFIX
Alias: None
Product: javafx
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Andrey Yamkovoy
URL:
Keywords: RELNOTE
Depends on:
Blocks:
 
Reported: 2008-04-22 11:14 UTC by Alexandr Scherbatiy
Modified: 2011-10-19 12:03 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandr Scherbatiy 2008-04-22 11:14:10 UTC
Steps to reproduce:

- Create 'FXLabel' fx file:
-----------------------------------------
import javafx.ui.*;

public class FXLabel extends CompositeWidget {
    public function composeWidget():Widget{
        return Label{ text:"Hello world!"}
    }
}
-----------------------------------------

- Create 'MyFrame' java file
----------------------------------------- 
import javax.swing.JFrame;

public class MyFrame extends JFrame {

    public MyFrame(){
        getContentPane().add(new FXLabel().getComponent());
    }
}
----------------------------------------- 

- Clean and build the project
  There is an error in the output:
 
JavaFXApplication\src\javafxapplication\MyFrame.java:12: cannot find symbol
symbol  : class FXLabel
location: class javafxapplication.MyFrame
        getContentPane().add(new FXLabel().getComponent());
1 error
BUILD FAILED (total time: 0 seconds)
Comment 1 Martin Ryzl 2008-04-22 13:25:58 UTC
Hmmm, an interesting issue. I wonder how this should work correctly. At the moment the build process uses following
sequence:
1. compile all files in the projects using javac. Obviously, javac ignores .fx files
2. compile all files using javafxc (or java -classpath javafxc.jar... equivalent). All .java classes are ignored
_because all corresponding .class files exist!_

Is there a way to build both .java and .fx files using one compiler in one step? Shall it be the goal?
Comment 2 _ tball 2008-04-22 14:59:25 UTC
This case cannot be supported yet.  One reason we chose javac as a base for javafxc was to eventually provide a single
compiler for both languages, but it was made clear early on that this is a low-priority "nice to have someday" feature.
 Significant work still needs to be done in the compiler to support multiple concurrent contexts, as right now only a
single set of FX or Java services can be used for any compiler context.  There are also potential initialization issues
haphazardly invoking FX objects from Java, as the two object models are different.  We support the most common case,
however:  FX classes which have references Java project classes.

This isn't an FX-specific bug, as what languages today can be used in a mixed-mode project:  JRuby, Jython, PHP?
NetBeans doesn't support this general scenario for any set of languages.  I think a reasonable workaround for any of
these cases is to break this project into two:  a Java library and FX application, or an FX library and a Java
application.  If this isn't possible because both projects have dependencies on each other, then this hairball needs to
be refactored, just like any other real project would (or should) be.  

Comment 3 Lark Fitzgerald 2008-07-15 22:29:29 UTC
Added: FXPLUGIN_PREVIEW_WAVED whiteboard.
Comment 4 Martin Ryzl 2008-10-29 14:21:59 UTC
I'm closing this as WONTFIX. There are two solutions - one suggested by tball to use project dependencies and another
one would be using of Java Scripting API
Comment 5 Alexandr Scherbatiy 2008-11-01 14:54:43 UTC
JIRA issue http://openjfx.java.sun.com/jira/browse/JFXC-2340
Comment 6 Alexandr Scherbatiy 2008-11-01 14:55:05 UTC
verified
Comment 7 David Strupl 2011-10-19 12:03:06 UTC
Cleaning bugzilla categories ....