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

Cannot add unimplemented methods to anonymous innerclasses

    XMLWordPrintableJSON

    Details

      Description

      Consider code like this:

      public class Test2 {

      public static void main(String[] args) {
      Comparator<String> c = new Comparator<String>() {
      };
      }

      }


       

      There is a method missing in the anonymous class, but an attempt to add it using the error fix leads to:

      java.lang.NullPointerException
      at org.netbeans.api.java.source.ElementUtilities.findUnimplementedMethods(ElementUtilities.java:904)
      at org.netbeans.api.java.source.ElementUtilities.findUnimplementedMethods(ElementUtilities.java:665)
      at org.netbeans.modules.java.editor.codegen.ImplementOverrideMethodGenerator.getImplementDescriptions(ImplementOverrideMethodGenerator.java:218)
      at org.netbeans.modules.java.editor.codegen.ImplementOverrideMethodGenerator.selectMethodsToImplement(ImplementOverrideMethodGenerator.java:145)
      at org.netbeans.modules.java.hints.errors.ImplementAllAbstractMethods$ImplementFixBase$1.run(ImplementAllAbstractMethods.java:320)
      at org.netbeans.modules.java.hints.errors.ImplementAllAbstractMethods$ImplementFixBase$1.run(ImplementAllAbstractMethods.java:316)
      at org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:502)
      at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)
      at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:130)
      at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:114)
      at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181)
      at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178)
      at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
      at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
      at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
      at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
      at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178)
      at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81)
      at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:452)
      at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:423)
      at org.netbeans.modules.java.hints.errors.ImplementAllAbstractMethods$ImplementFixBase.implement(ImplementAllAbstractMethods.java:316)
      [catch] at org.netbeans.modules.editor.hints.HintsUI$1.run(HintsUI.java:810)
      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
      at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
      at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

       

      Originally reported here:

      http://mail-archives.apache.org/mod_mbox/netbeans-users/201911.mbox/%3C2971b37b-5471-2ec8-f52d-28ac2b3e6165%40univ-cotedazur.fr%3E

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jlahoda Jan Lahoda
                Reporter:
                jlahoda Jan Lahoda
              • Votes:
                0 Vote for this issue
                Watchers:
                2 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