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

JavaCompletionTask.inferDeclaredType causes IllegalArgumentException in javac's getDeclaredType

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 11.3
    • None
    • java - Source
    • None
    • Java 14

    Description

      In the following example (minimized based on an actual editing session), opening code completion with Ctrl+Space after "obj." causes an exception:

      public class SomeClass {
        private void someMethod() {
          String obj = null;
          SomeClass2.SomeClass3 foozle = obj. // To trigger error, open code completion after "obj."
        }
      
        class SomeClass2<K> {
          class SomeClass3<E> {
          }
        }
      }
      

      The exception is as follows:

      java.lang.IllegalArgumentException: com.mycompany.exihibitcompletion.SomeClass.SomeClass2.SomeClass3
      	at com.sun.tools.javac.model.JavacTypes.getDeclaredType(JavacTypes.java:243)
      	at org.netbeans.modules.java.completion.JavaCompletionTask.inferDeclaredType(JavaCompletionTask.java:5855)
      	at org.netbeans.modules.java.completion.JavaCompletionTask.isOfSmartType(JavaCompletionTask.java:4938)
      	at org.netbeans.modules.java.completion.JavaCompletionTask.addMembers(JavaCompletionTask.java:3692)
      	at org.netbeans.modules.java.completion.JavaCompletionTask.insideMemberSelect(JavaCompletionTask.java:1836)
      	at org.netbeans.modules.java.completion.JavaCompletionTask.resolve(JavaCompletionTask.java:375)
      	at org.netbeans.modules.java.completion.BaseTask.run(BaseTask.java:94)
      	at org.netbeans.modules.java.completion.JavaCompletionTask.run(JavaCompletionTask.java:60)
      	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)
      Caused: org.netbeans.modules.parsing.spi.ParseException
      	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:186)
      	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81)
      [catch] at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery.query(JavaCompletionProvider.java:193)
      	at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:198)
      	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)
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ebakke Eirik Bakke
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: