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

Compilation error (NullPointerException) caused

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 8u25
    • tools
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0_25"
      Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
      Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Upon compiling the source code given below, the compiler crashes and gives a NullPointerException. Strangely, I could build a complete day until the problem started occuring.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the source code given below with javac Bug.java

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Plain compilation error that mentions the non inclusion of the class HashMap or the non existence of the two argument constructor
      ACTUAL -
      Failure executing javac, but could not parse the error:
      An exception has occurred in the compiler (1.8.0_25). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.NullPointerException
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitNewClass(Flow.java:1239)
      at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1516)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1230)
      at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:175)
      at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1296)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitBlock(Flow.java:993)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitMethodDef(Flow.java:960)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitClassDef(Flow.java:923)
      at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1323)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1313)
      at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:212)
      at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1327)
      at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1296)
      at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
      at com.sun.tools.javac.main.Main.compile(Main.java:523)
      at com.sun.tools.javac.main.Main.compile(Main.java:381)
      at com.sun.tools.javac.main.Main.compile(Main.java:370)
      at com.sun.tools.javac.main.Main.compile(Main.java:361)
      at com.sun.tools.javac.Main.compile(Main.java:74)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:554)
      at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:161)
      at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:605)
      at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

      1 error

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Failure executing javac, but could not parse the error:
      An exception has occurred in the compiler (1.8.0_25). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.NullPointerException
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitNewClass(Flow.java:1239)
      at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1516)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1230)
      at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:175)
      at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1296)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitBlock(Flow.java:993)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitMethodDef(Flow.java:960)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitClassDef(Flow.java:923)
      at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1323)
      at com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1313)
      at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:212)
      at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1327)
      at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1296)
      at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
      at com.sun.tools.javac.main.Main.compile(Main.java:523)
      at com.sun.tools.javac.main.Main.compile(Main.java:381)
      at com.sun.tools.javac.main.Main.compile(Main.java:370)
      at com.sun.tools.javac.main.Main.compile(Main.java:361)
      at com.sun.tools.javac.Main.compile(Main.java:74)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:554)
      at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:161)
      at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:605)
      at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

      1 error

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Map;

      public class Bug
      {
          public Bug(String s, Map<String,String> map, String b)
          {
              
          }
          
          public Bug()
          {
              this(null, new HashMap<>());
          }
         
      }

      ---------- END SOURCE ----------

            pardesha Pardeep Sharma
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: