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

"AssertionError" when writing an annotation inside of a type cast

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 9.0
    • None
    • cnd - Code Completion
    • None
    • IDE: NetBeans 9 RC1
      OS : Debian 9.4 - Stretch - amd64
      Kernel: Linux 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
      JDK: Oracle JDK 10.0.1

    Description

      I've just created a Maven project that uses JAR packaging and Java 10. I've added a class called "Main" and I've written this in it:

      public class Main {
      
          public static void main (String[] arguments) {
              var foo = (String) null;
          }
      
      }

       

      Then, I've typed an "at" symbol (@) inside the type cast, in order to get this:

      public class Main {
      
          public static void main (String[] arguments) {
              var foo = (@Nullable String) null;
          }
      
      }

       

      But NetBeans has thrown the following exception:

      java.lang.AssertionError
          at com.sun.tools.javac.util.Assert.error(Assert.java:155)
          at com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:62)
          at com.sun.tools.javac.comp.Annotate.fromAnnotations(Annotate.java:167)
          at com.sun.tools.javac.comp.Annotate.lambda$annotateTypeSecondStage$5(Annotate.java:1031)
          at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:194)
          at com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:144)
          at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:333)
          at com.sun.tools.javac.comp.Attr.visitClassDef(Attr.java:953)
          at org.netbeans.lib.nbjavac.services.NBAttr.visitClassDef(NBAttr.java:57)
          at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:778)
          at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:660)
          at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
          at com.sun.tools.javac.comp.Attr.visitAnonymousClassDefinition(Attr.java:2495)
          at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:2379)
          at org.netbeans.lib.nbjavac.services.NBAttr.visitNewClass(NBAttr.java:74)
          at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1695)
          at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:660)
          at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:706)
          at org.netbeans.modules.java.hints.spiimpl.Utilities.attributeTree(Utilities.java:650)
          at org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:430)
          at org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:344)
          at org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:324)
          at org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:320)
          at org.netbeans.modules.java.hints.spiimpl.pm.PatternCompiler.compile(PatternCompiler.java:44)
          at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.doComputeHints(HintsInvoker.java:535)
          at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHintsImpl(HintsInvoker.java:283)
          at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:228)
          at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:193)
          at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:166)
          at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:128)
          at org.netbeans.modules.java.hints.spiimpl.hints.HintsTask.run(HintsTask.java:114)
          at org.netbeans.modules.java.hints.spiimpl.hints.HintsTask.run(HintsTask.java:65)
          at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:273)
          at org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:561)
          at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:786)
          at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
          at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
      [catch] at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          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)
      
      

      Thank you!

       

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: