karthikeyan created NETBEANS-5861:
-------------------------------------
Summary: Java/NetBeans : Navigator Hangs upon encountering
Anonymous Classes
Key: NETBEANS-5861
URL: https://issues.apache.org/jira/browse/NETBEANS-5861
Project: NetBeans
Issue Type: Bug
Components: ide - UI, java - Editor
Affects Versions: 12.0
Environment: Product Version: Apache NetBeans IDE 12.0
Java: 15.0.1; Java HotSpot(TM) 64-Bit Server VM 15.0.1+9-18
Runtime: Java(TM) SE Runtime Environment 15.0.1+9-18
System: Windows 10 version 10.0
Reporter: karthikeyan
Attachments: AnonymousClassReplaced.jpg, JFrameCreationErr.jpg,
NavigatorHangs.jpg
1. IDE displays error while creating a Java Swing, JFrame Form using IDE (
E.g. While trying to create a JFrame form with name "SwingButtonDemo" inside
package "Demo" it shows
"The file SwingButtonDemo.java already exists"
Screen shot attached (JFrameCreationErr.jpg)
But, anyway it creates the package and the Java Source file and it is visible
in the Project Window
2. The Design View of this JFrame Source File has no problem but when trying to
explore the source code of this java file "SwingButtonDemo.java", the Navigator
Window simply hangs. Screen shot attached (NavigatorHangs.jpg). This happens
not only here. Wherever there is an anonymous class used, the Navigator simply
hangs. So it is not possible to do the coding in the source editor as the
context sensitive help of showing up list of members/functions of an object
does not work because the Navigator hangs.
Here the following code snippet which caused the problem is :
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SwingButtonDemo().setVisible(true);
}
});
Replacing the above code snippet with Lambda Expression solves the problem and
bring back the Navigator to function properly. Screen shot attached
AnonymousClassReplaced.jpg).
Runnable SwRun = () -> {
new SwingButtonDemo().setVisible(true);
};
java.awt.EventQueue.invokeLater(SwRun);
But the problem is , here the source code is editable. But when we add
components and register EventListeners, the IDE generates code that are
uneditable and it invariably uses Anonymous classes, making the Navigator to
hang. Is there any setting with which the Navigator can be configured to ignore
Anonymous classes or there any fix ?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists