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 183679 - Fix Imports often add in java.lang.Boolean, java.lang.Void, java.lang.Long, etc
Summary: Fix Imports often add in java.lang.Boolean, java.lang.Void, java.lang.Long, etc
Status: VERIFIED FIXED
Alias: None
Product: javafx
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: J Bachorik
URL: http://javafx-jira.kenai.com/browse/J...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-07 23:47 UTC by Torbjorn Norbye
Modified: 2010-04-20 07:10 UTC (History)
1 user (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 Torbjorn Norbye 2010-04-07 23:47:23 UTC
Sometimes when I have unused imports I'll press Cmd-Shift-i to clean up the imports -- and often I'll then get compiler errors. When I look at the diffs I notice that I suddenly have import statements like this:

import java.lang.Boolean;
import java.lang.Void;

This then causes my compilation to fail. I haven't worked out exactly how to reproduce this in a small test case, but in the most recent case where this happened, I had a JavaFX class which implemented a Java interface.

I think the JavaFX Imports Fixer should make sure it never tries to import any of the basic java.lang. types -- "Boolean" and "Void" should be left unspecified in the source such that the JavaFX compiler handles it correctly (since these signatures often map to primitives, say "boolean", instead of (in this case) Boolean.
Comment 1 J Bachorik 2010-04-12 12:41:31 UTC
Not sure what could be causing this - the fix imports operations adds only those type names which are marked as unresolvable by the compiler. So it seems that the compiler marks java.lang.* types as unresolvable, for whatever reason.
The other thing is that I was not able to reproduce it - I've tried various code snippets (event with implementing a java interface) but with no success :(

If you are able to provide a code snippet which reliably turns this bug on, plz, attach it here end reopen this issue.
Comment 2 Alexandr Scherbatiy 2010-04-12 13:48:21 UTC
Steps to reproduce:

- Create Space JavaFX class
----------------  Space.fx ------------------
package javafxapplication15;

public class Space {

    public function run(){
    }

}
---------------------------------------------

- Create NewtonSpace JavaFX class
----------------  NewtonSpace.fx ------------------

package javafxapplication15;


public class NewtonSpace extends Space{

    override function run() {
    }

}
---------------------------------------------

- Fix imports in the NewtonSpace.fx file

The result is:
-------------------------------------
package javafxapplication15;
import java.lang.Void;


public class NewtonSpace extends Space{
-------------------------------------
Comment 3 J Bachorik 2010-04-12 15:10:48 UTC
Thanks for the example. I was able to pinpoint the problem and fix it.
Basically, javafxc, for some reason fails to provide a symbol for the tree representing a built-in typename using the API even if the information is there.

Working around this problem by directly accessing the symbol information circumventing the API ...

http://hg.netbeans.org/javafx/rev/0749f7c9e191
Comment 4 Alexandr Scherbatiy 2010-04-13 07:42:18 UTC
Should the compiler issue be created as well?
Comment 5 J Bachorik 2010-04-13 07:48:00 UTC
Yes, you can create a javafxc issue. I just didn't feel like spending more time in creating an automated test case for the compiler than working the issue around :(
Comment 6 Alexandr Scherbatiy 2010-04-13 07:58:00 UTC
Compiler issue http://javafx-jira.kenai.com/browse/JFXC-4287
Comment 7 Alexandr Scherbatiy 2010-04-16 11:09:30 UTC
The issue is still reproduced in build 
NetBeans-JavaFX-Soma: #221 Apr 15, 2010 12:00:58 AM
Comment 8 J Bachorik 2010-04-19 07:02:00 UTC
The TypeClass contains a corresponding Identifier (not sure if that's a general rule or not) and the Identifier suffers from the same problem as the TypeClass - it can not resolve the type element for the built-in types. Working around ...

http://hg.netbeans.org/javafx/rev/923b5722fb38
Comment 9 Alexandr Scherbatiy 2010-04-20 07:10:21 UTC
verified in NetBeans-JavaFX-Soma: #227