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.
I used Fix Imports after adding a referenced class to an inner class. The following exception occurred: java.lang.ClassCastException at org.netbeans.modules.javacore.jmiimpl.javamodel.NewClassExpr essionImpl.initChildren(NewClassExpressionImpl.java:111) at org.netbeans.modules.javacore.jmiimpl.javamodel.NewClassExpr essionImpl.getEnclosingClass(NewClassExpressionImpl.java:48) at org.netbeans.jmi.javamodel.NewClassExpression$Impl.getEnclos ingClass(Unknown Source) at org.netbeans.modules.javacore.jmiimpl.javamodel.NewClassExpr essionImpl.getChildren(NewClassExpressionImpl.java:98) at org.netbeans.jmi.javamodel.NewClassExpression$Impl.getChildr en(Unknown Source) at org.netbeans.modules.editor.java.JavaFixAllImports.findPotential ClassNames(JavaFixAllImports.java:463) at org.netbeans.modules.editor.java.JavaFixAllImports.findPotential ClassNames(JavaFixAllImports.java:469) at org.netbeans.modules.editor.java.JavaFixAllImports.findPotential ClassNames(JavaFixAllImports.java:469) at org.netbeans.modules.editor.java.JavaFixAllImports.findPotential ClassNames(JavaFixAllImports.java:477) at org.netbeans.modules.editor.java.JavaFixAllImports.addAllNeede dImports(JavaFixAllImports.java:98) at org.netbeans.modules.editor.java.JavaFixAllImports.actionPerfor med(JavaFixAllImports.java:59) at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java :178) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1535) at javax.swing.JComponent.processKeyBinding(JComponent.java: 2438) at javax.swing.JComponent.processKeyBindings(JComponent.java: 2473) at javax.swing.JComponent.processKeyEvent(JComponent.java: 2401) at java.awt.Component.processEvent(Component.java: 4975) at java.awt.Container.processEvent(Container.java:1613) at java.awt.Component.dispatchEventImpl(Component.java: 3681) at java.awt.Container.dispatchEventImpl(Container.java: 1671) at java.awt.Component.dispatchEvent(Component.java: 3543) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocus Manager.java:1713) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Defaul tKeyboardFocusManager.java:627) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(De faultKeyboardFocusManager.java:831) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(De faultKeyboardFocusManager.java:741) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKe yboardFocusManager.java:592) at java.awt.Component.dispatchEventImpl(Component.java: 3572) at java.awt.Container.dispatchEventImpl(Container.java: 1671) at java.awt.Window.dispatchEventImpl(Window.java:1606) at java.awt.Component.dispatchEvent(Component.java: 3543) [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java: 456) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Event DispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDis patchThread.java:184) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread .java:178) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread .java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100)
Do you have the source file where you tried to fix the imports when this exception was thrown by any change?
No idea what class it was at this point. Maybe add some assertion to give more info about what was being cast?
I am not able to reproduce it. Please attach the source code when it happens again. This is most likely a problem in the parser returing wrong type of AST element.
Seems to be fixed - no additional info provided and nobody seems to report a similar problem.
Reorganization of java component