Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8274410

java: java.lang.AssertionError: Incorrect number of arguments; expected 2, found 0

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      java: An exception has occurred in the compiler (16.0.1). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
      java: java.lang.AssertionError: Incorrect number of arguments; expected 2, found 0
      java: at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:162)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitApply(TransTypes.java:666)
      java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1745)
      java: at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:455)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitLambda(TransTypes.java:541)
      java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1922)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translateArgs(TransTypes.java:213)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitApply(TransTypes.java:669)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitVarDef(TransTypes.java:500)
      java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:983)
      java: at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
      java: at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:167)
      java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1047)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitReturn(TransTypes.java:622)
      java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1657)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitMethodDef(TransTypes.java:490)
      java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:893)
      java: at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.visitClassDef(TreeTranslator.java:139)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translateClass(TransTypes.java:948)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitClassDef(TransTypes.java:476)
      java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:790)
      java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translateTopLevelClass(TransTypes.java:972)
      java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1556)
      java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1435)
      java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
      java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
      java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
      java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
      java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
      java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:238)
      java: at org.jetbrains.jps.incremental.java.JavaBuilder.lambda$compileJava$2(JavaBuilder.java:513)
      java: at org.jetbrains.jps.incremental.java.JavaBuilder.invokeJavac(JavaBuilder.java:559)
      java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:511)
      java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:354)
      java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:279)
      java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:233)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1485)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1123)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1268)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1088)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:854)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:441)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:190)
      java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:132)
      java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:318)
      java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:146)
      java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:218)
      java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
      java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
      java: at java.base/java.lang.Thread.run(Thread.java:831)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      In the following expression remove the type of TypeLiteral. This code compiles:

      OakKnownTypes.OakRecord<K> keyRecord =
              Optional.ofNullable(OakKnownTypes.lookupRecord(key))
              .orElseGet(() -> helper.getOrDefault(new TypeLiteral<OakKnownTypes.OakRecord<K>>() {}, () -> inferOakRecord(key)));


      This one fails:
      OakKnownTypes.OakRecord<K> keyRecord =
                          Optional.ofNullable(OakKnownTypes.lookupRecord(key))
                          .orElseGet(() -> helper.getOrDefault(new TypeLiteral<>() {}, () -> inferOakRecord(key)));



        Attachments

          Activity

            People

            Assignee:
            adev ANUPAM DEV
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: