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

NPE during compile

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      java version "1.8.0_112"
      Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
      Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux auaisdev017 2.6.32-642.6.1.el6.x86_64 #1 SMP Thu Aug 25 12:42:19 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      this has only appeared (so far) after a power outage, which may have left class files in a corrupted state - clearcase is the source control system being used and the output class files are also being built to a clearcase directory (as view-private files).

      A DESCRIPTION OF THE PROBLEM :
      After a power outage at my work, I attempted to build code that had previously been building just fine, and run into a NPE from the compiler. We use Ant's javac task to perform our compilation. I was able to consistently reproduce this error each time by running the ant build target. Performing a subsequent clean (remove all classes built for the target) and rebuild seemed to clear the issue for now. I suspect this NPE was caused by one of the class files being corrupted when we lost power to the clearcase server the output of javac goes to (as view-private files). Unfortunately, due to the sensitive nature of my project, I am unable to provide any of the class files it was trying to build.

          [javac] An exception has occurred in the compiler (1.8.0_112). 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.
          [javac] java.lang.NullPointerException
          [javac] at com.sun.tools.javac.jvm.Code.width(Code.java:279)
          [javac] at com.sun.tools.javac.jvm.ClassReader.initParameterNames(ClassReader.java:2082)
          [javac] at com.sun.tools.javac.jvm.ClassReader.readMethod(ClassReader.java:2040)
          [javac] at com.sun.tools.javac.jvm.ClassReader.readClass(ClassReader.java:2252)
          [javac] at com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:2324)
          [javac] at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2511)
          [javac] at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:2442)
          [javac] at com.sun.tools.javac.jvm.ClassReader.access$000(ClassReader.java:76)
          [javac] at com.sun.tools.javac.jvm.ClassReader$1.complete(ClassReader.java:240)
          [javac] at com.sun.tools.javac.code.Symbol.complete(Symbol.java:574)
          [javac] at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1037)
          [javac] at com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:973)
          [javac] at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:369)
          [javac] at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:365)
          [javac] at com.sun.tools.javac.comp.Resolve.findImmediateMemberType(Resolve.java:1935)
          [javac] at com.sun.tools.javac.comp.Resolve.findMemberType(Resolve.java:1990)
          [javac] at com.sun.tools.javac.comp.Resolve.findIdentInType(Resolve.java:2174)
          [javac] at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3412)
          [javac] at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3278)
          [javac] at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
          [javac] at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
          [javac] at com.sun.tools.javac.comp.Attr.attribType(Attr.java:638)
          [javac] at com.sun.tools.javac.comp.Attr.attribType(Attr.java:631)
          [javac] at com.sun.tools.javac.comp.MemberEnter.attribImportType(MemberEnter.java:834)
          [javac] at com.sun.tools.javac.comp.MemberEnter.visitImport(MemberEnter.java:558)
          [javac] at com.sun.tools.javac.tree.JCTree$JCImport.accept(JCTree.java:571)
          [javac] at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:437)
          [javac] at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:449)
          [javac] at com.sun.tools.javac.comp.MemberEnter.visitTopLevel(MemberEnter.java:528)
          [javac] at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:518)
          [javac] at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:437)
          [javac] at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:1038)
          [javac] at com.sun.tools.javac.code.Symbol.complete(Symbol.java:574)
          [javac] at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1037)
          [javac] at com.sun.tools.javac.comp.Enter.complete(Enter.java:493)
          [javac] at com.sun.tools.javac.comp.Enter.main(Enter.java:471)
          [javac] at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982)
          [javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:857)
          [javac] at com.sun.tools.javac.main.Main.compile(Main.java:523)
          [javac] at com.sun.tools.javac.main.Main.compile(Main.java:381)
          [javac] at com.sun.tools.javac.main.Main.compile(Main.java:370)
          [javac] at com.sun.tools.javac.main.Main.compile(Main.java:361)
          [javac] at com.sun.tools.javac.Main.compile(Main.java:56)
          [javac] at com.sun.tools.javac.Main.main(Main.java:42)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Please don't try to recreate the scenario we experienced - flipping the master breaker to your building probably isn't the best career advancement path.

      Perhaps create a corrupt class file with a signature that would be evaluated by the initParameterNames trace from the bug description?

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      If the file is corrupted, I would expect the compiler to warn me about that rather than throwing an NPE.
      ACTUAL -
      NPE was thrown

      REPRODUCIBILITY :
      This bug can be reproduced rarely.

      ---------- BEGIN SOURCE ----------
      Unfortunately, since this is not reproducible under nominal or even less-happy-path conditions, it would be difficult to find a SSCCE that would reproduce this reliably without digging through the code to create a contrived example.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      removing the class files already built as part of the previous compile and running the compile again seemed to resolve the issue.

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

              Created:
              Updated:
              Resolved: