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.
040716. Just was editing some class - syntactically correct AFAIK - and pressed Alt-Shift-F. IDE froze for about a minute, disk thrashing for some reason, then got an NPE. Not sure if it actually fixed any imports or not.
Created attachment 16303 [details] Stack trace
The NPE is thrown from the following line of TransientElement.init: this.resource = (ResourceImpl) ((MDRParser) tree.getASTContext()).getResource(); At this point tree is surely not null, so it seems that tree.getASTContext() returned null. If that's the case, then it is likely a bug in gjast. We need to add a debug info to the source so that next time the exception occurs the IDE reports also the type of the tree that caused this and possibly some additional info.
Jesse, could you please attach the class you were editing? Is the exception reproducible with that file?
I'm sorry, I don't remember what class it was now (and anyway I have probably made edits to it since then). Note that Fix Imports has worked fine since then on other sources.
It is very likely that you had a special construct in your class that the gjast (javac bridge) does not represent correctly (does not provide ASTContext for it). But it is hard to find what kind of AS tree causes that. I will try to add some debug messages so that next time this occurs we will be able to get more info.
Got it again in projects/projectui/src/org/netbeans/modules/project/ui/ProjectChooserAccessory.java after making some edits and running Fix Imports. Will attach text of class after the exception appeared.
Created attachment 16306 [details] Class after exception appeared
Fixed. Checking in src/org/netbeans/modules/javacore/jmiimpl/javamodel/TransientElement.java; /cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/TransientElement.java,v <-- TransientElement.java new revision: 1.5; previous revision: 1.4 done
Should this now be FIXED?
There are more specific information in #46451 about this problem. *** This issue has been marked as a duplicate of 46451 ***