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

CLONE - AssertionError while typing before an annotation in anonymous inner class

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 10.0
    • None
    • java - Source
    • None

    Description

      Paste the following into a code file:

          public static InputStream foo(InputStream from){
                  return new InputStream() {
                  MemoryStream ms = new MemoryStream();
                  GZIPOutputStream compress = new GZIPOutputStream(ms.getOutputStream());
                  
                  @Override
                  public int read() throws IOException {
                      throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                  }
              }
          }
      

      and try to type "byte[] buffer" above the Override Annotation. An assertion error will be thrown with the stack trace of:

      Assert.error:155    
      Assert.checkNonNull:62    
      Annotate.fromAnnotations:167    
      Annotate.lambda$annotateTypeSecondStage$5:1031    
      861978341.run    
      Annotate.flush:194    
      Annotate.unblockAnnotations:144    
      TypeEnter.complete:229    
      Symbol.complete:645    
      Symbol$ClassSymbol.complete:1352    
      Attr.visitClassDef:982    
      NBAttr.visitClassDef:61    
      JCTree$JCClassDecl.accept:778    
      Attr.attribTree:673    
      Attr.attribStat:749    
      Attr.visitAnonymousClassDefinition:2508    
      Attr.visitNewClass:2391    
      JCTree$JCNewClass.accept:1695    
      Attr.attribTree:673    
      Attr.visitReturn:1931    
      JCTree$JCReturn.accept:1552    
      Attr.attribTree:673    
      Attr.attribStat:749    
      Attr.attribStats:773    
      Attr.visitBlock:1350    
      NBAttr.visitBlock:73    
      JCTree$JCBlock.accept:1026    
      Attr.attribTree:673    
      Attr.attribStat:749     
      JavacParser.parseImpl:399    
      JavacParser.parse:332    
      TaskProcessor.callParse:598    
      SourceCache.getResult:228    
      ResultIterator.getParserResult:115    
      ResultIterator.getParserResult:129   
      TaskProcessor.callUserTask:586    
      ParserManager$UserTaskAction.run:130    
      ParserManager$UserTaskAction.run:114    
      TaskProcessor$2.call:181    
      TaskProcessor$2.call:178    
      FileChangedManager.priorityIO:153    
      ProvidedExtensions.priorityIO:335    
      DataObjectEnvFactory.runPriorityIO:118    
      Utilities.runPriorityIO:67    
      TaskProcessor.runUserTask:178    
      ParserManager.parse:81    
      JPACodeCompletionProvider$JPACodeCompletionQuery.query:118    
      AsyncCompletionTask.run:198    
      RequestProcessor$Task.run:1418    
      GlobalLookup.execute:45    
      Lookups.executeWith:278    
      RequestProcessor$Processor.run:2033   

       It will also explode with a NullPointer if you try to add a variable before "MemoryStream" (e.g. "byte[] buffer =")

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            asianuniversity info.asianuniversity

            Dates

              Created:
              Updated:

              Slack

                Issue deployment