John Brice created NETBEANS-1785:
------------------------------------

             Summary: NPE when resolving imports for pasted code
                 Key: NETBEANS-1785
                 URL: https://issues.apache.org/jira/browse/NETBEANS-1785
             Project: NetBeans
          Issue Type: Bug
    Affects Versions: 10.0
         Environment: Windows 10 1803 (64-bit)
Netbeans 10vc4
AdoptOpenJDK 11.0.1
OpenJFX 11.0.1
            Reporter: John Brice
         Attachments: pasted-code-npe.zip

Pasting code into JavaFX start method of a Java application, NetBeans offers to 
resolve imports. Clicking OK results in a Null Pointer Exception. Cancel the 
dialog, then Ctrl+Shift+I imports correct classes.

 

Steps to reproduce:

Create new Java application.
Add OpenJFX jars to classpath and modulepath.
Add --module-path %PATH_TO_FX% and --add-modules javafx.controls,javafx.fxml to 
VM options.
Make main class extend Application, implement all abstract methods, change main 
method body to:
{code:java}
    public static void main(String[] args) {
        launch(args);
    }{code}

Paste this code into start method:
{code:java}
    @Override
    public void start(Stage stage) throws Exception {
        Parent root = FXMLLoader.load(getClass().getResource("FTGui.fxml"));
        stage.setTitle("Hello World");
        stage.setScene(new Scene(root, 300, 275));
        stage.show();
    }{code}
Netbeans dialog pops up offering to resolve imports for pasted code.
Click OK, get NPE.
Cancel import dialog, press Ctrl+Shift+I and correct classes are imported.
Run or debug and the app runs successfully.

Crash report attached.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to