Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-5861

Java/NetBeans : Navigator Hangs upon encountering Anonymous Classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 12.0
    • None
    • ide - UI, java - Editor
    • None
    • 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

    Description

      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 ?

      Attachments

        1. AnonymousClassReplaced.jpg
          353 kB
          karthikeyan
        2. JFrameCreationErr.jpg
          283 kB
          karthikeyan
        3. NavigatorHangs.jpg
          338 kB
          karthikeyan

        Activity

          People

            Unassigned Unassigned
            karthik4_pk karthikeyan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: