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

NPE on Find Usages and Call Hierarchy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 11.1, 11.2
    • 11.2
    • java - Refactoring
    • Java: 1.8.0_212; Java HotSpot(TM) 64-Bit Server VM 25.212-b10
      Runtime: Java(TM) SE Runtime Environment 1.8.0_212-b10
      System: Windows 10 version 10.0 running on amd64; utf-8; en_US (nb)

    Description

      Please see the Maven project in the attached Example.zip. To reproduce the the issue:

      1. Open the project in NetBeans
      2. Download the Guava dependency
      3. Wait until background scanning etc. has completed
      4. In Test1.java, perform Find Usages or Call Hierarchy on the getResult() method
      5. In the case of Call Hierarchy, the processLine() node must be expanded to trigger the error
      6. When performing Find Usages after Call Hierarchy, at least under NB 11.1 the first execution triggers no error, but the results list remains empty, however a second execution triggers the exception

      => An Unexpected Exception occurs, see the stacktraces in the attached stacktraces.txt

      The necessary condition for the error to occur is apparently that both the method in question as well as its caller must be methods overridden from the same interface, and that the interface must be defined in a separate jar for which there is no NetBeans project present. (That's why I used the Guava dependency for the reproducible example project.)

      I first reproduced the issue in NetBeans 11.1 and then was able to reproduce it in 11.2-beta1.

      The error is also reproducible with a reset (deleted) cachedir/index.

      I used 11.2-beta1 with the default settings (no imported settings), just with nb-javac 1.71 installed.

      Test2.java shows that the error also occurs when the caller and callee methods are in different classes, but inherited from the same interface.

      In Test3 and Test4, the calling method is overriden from the base class and from a different interface (respectively), which causes the error to NOT happen for Call Hierarchy, but it does STILL happen for Find Usages.

      In the Find Usages dialog, "From: LineProcessor" must be selected. The error doesn't occur with "From: Test1". The selected scope on the other hand doesn't seem to make a difference.

       

      Attachments

        1. Example.zip
          4 kB
          Niklas Matthies
        2. stacktraces.txt
          5 kB
          Niklas Matthies

        Issue Links

          Activity

            People

              Unassigned Unassigned
              matthies Niklas Matthies
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m