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

Internal compiler exception. NullPointerException when "configure" method (model mapper jar) is empty

XMLWordPrintable

    • x86_64
    • windows_10

      FULL PRODUCT VERSION :
      java version "9.0.1"
      Java(TM) SE Runtime Environment (build 9.0.1+11)
      Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 10

      A DESCRIPTION OF THE PROBLEM :
      When you use ModellMapper (org.modelmapper) and you want create new PropertyMap (anonymous abstract class with "configure" method and you leave this method empty. Then NullPointerException occurs in the compiler.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run code that is below.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No NullPointerException
      ACTUAL -
      Internal java compiler error

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Information:java: An exception has occurred in the compiler (9). 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 and the following diagnostic in your report. Thank you.
      Information:java: java.lang.NullPointerException
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1233)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1628)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:393)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:213)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1446)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitBlock(Flow.java:995)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1014)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitMethodDef(Flow.java:962)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitClassDef(Flow.java:925)
      Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:774)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1325)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1315)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:213)
      Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1389)
      Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1363)
      Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:959)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:100)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:142)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:96)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:90)
      Information:java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:190)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:481)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:331)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:258)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:216)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1260)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:937)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1009)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:900)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:733)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:385)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:192)
      Information:java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
      Information:java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:308)
      Information:java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:138)
      Information:java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:235)
      Information:java: at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
      Information:java: at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
      Information:java: at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
      Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
      Information:java: at java.base/java.lang.Thread.run(Thread.java:844)
      Information:java: Errors occurred while compiling module 'GPF'
      Information:javac 9 was used to compile java sources
      Information:07.12.2017 12:39 - Compilation completed with 1 error and 0 warnings in 2s 651ms
      Error:java: Compilation failed: internal java compiler error

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      UserDTO user = UserDTO.builder()
                      .email("email")
                      .password("pass")
                      .username("name")
                      .build();

              GameDTO game = GameDTO.builder()
                      .name("game")
                      .description("desc")
                      .user(user)
                      .build();

              user.setUserGames(newArrayList(game));

              ModelMapper mapper = new ModelMapper();
              TypeMap<GameDTO, GameData> typeMap = mapper.createTypeMap(GameDTO.class, GameData.class);
              typeMap.addMappings(new PropertyMap<>() {
                  @Override
                  protected void configure() {
                  }
              });
              GameData data = typeMap.map(game);
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I think it is impossible

            fmatte Fairoz Matte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: