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

Compilation fails with an exception jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitApply

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      OS: Microsoft Windows 10 Pro, v10.0.17763 build 17763
      Java:
      openjdk version "14-ea" 2020-03-17
      OpenJDK Runtime Environment (build 14-ea+8-255)
      OpenJDK 64-Bit Server VM (build 14-ea+8-255, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      Information:Kotlin: kotlinc-jvm 1.3.41 (JRE 11.0.4+11)
      Information:java: An exception has occurred in the compiler (14-ea). 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.
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitApply(TransTypes.java:661)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1737)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:455)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitLambda(TransTypes.java:541)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1914)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translateArgs(TransTypes.java:213)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitApply(TransTypes.java:664)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitAssign(TransTypes.java:722)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAssign.accept(JCTree.java:1981)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitExec(TransTypes.java:611)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1523)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:167)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1030)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitMethodDef(TransTypes.java:490)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:876)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.visitClassDef(TreeTranslator.java:139)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translateClass(TransTypes.java:943)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.visitClassDef(TransTypes.java:476)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:784)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.TransTypes.translateTopLevelClass(TransTypes.java:967)
      Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1558)
      Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1437)
      Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:972)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
      Information:java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:195)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:460)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:330)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:255)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:213)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1324)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1004)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1071)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:965)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:794)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:376)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
      Information:java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:139)
      Information:java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:288)
      Information:java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:121)
      Information:java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228)
      Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      Information:java: at java.base/java.lang.Thread.run(Thread.java:830)
      Information:java: Errors occurred while compiling module 'jdk11bug.main'
      Information:javac 14-ea was used to compile java sources
      Information:08.08.2019 14:56 - Build completed with 2 errors and 0 warnings in 4 s 631 ms
      Error:java: java.lang.AssertionError: Incorrect number of arguments; expected 4, found 0
      Error:java: at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:162)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Build Spring Boot application with IntelliJ IDEA Ultimate 2019.2 using JDK 14 EA using gradle v5.4.1 as build tool

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Code should compile
      ACTUAL -
      Code does not compile

      ---------- BEGIN SOURCE ----------
      package com.icefire.jdk11bug;

      import org.springframework.boot.SpringApplication;
      import org.springframework.boot.autoconfigure.SpringBootApplication;
      import org.springframework.core.ParameterizedTypeReference;
      import org.springframework.http.HttpMethod;
      import org.springframework.http.ResponseEntity;
      import org.springframework.web.client.RestTemplate;

      import java.util.Set;

      @SpringBootApplication
      public class Jdk11bugApplication {

      @FunctionalInterface
      public interface ApiCall<T> {
      ResponseEntity<T> execute();
      }

      private RestTemplate restTemplate;

      public Set<String> getResult() {
      Set<String> response;
      response = callApi(() -> restTemplate.exchange(
      "/abc",
      HttpMethod.GET,
      null,
      new ParameterizedTypeReference<>() {
      }));
      return response;
      }

      public <T> T callApi(final ApiCall<? extends T> apiCall) {
      return apiCall.execute().getBody();
      }

      public static void main(String[] args) {
      SpringApplication.run(Jdk11bugApplication.class, args);
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Add type information to ParameterizedTypeReference instantiation:
      new ParameterizedTypeReference<Set<String>>() {}

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jlahoda Jan Lahoda
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: