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

Java 8 compiler throws NullPointerException depending location in source file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8u20
    • 8
    • tools
    • b20
    • x86_64
    • windows_7

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

        ADDITIONAL OS VERSION INFORMATION :
        Windows 7 (64 bit)
        Linux (64 bit)

        A DESCRIPTION OF THE PROBLEM :
        On our open-source project BRJS (https://github.com/BladeRunnerJS/brjs), we have seen that when we renamed a public abstract class to 'AbstractAssetLocation', it throws a NullPointerException with the Java 8 compiler.

        --------------------------------------------------
        An exception has occurred in the compiler (1.8.0). 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$AbstractAssignAnalyzer.trackable(Flow.java:1479)
                at com.sun.tools.javac.comp.Flow$AssignAnalyzer.checkInit(Flow.java:2454)
                at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.checkInit(Flow.java:1555)
                at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitIdent(Flow.java:2328)
                at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2005)
                at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
                at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:389)
                at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1367)
                at com.sun.tools.javac.tree.TreeScanner.visitSelect(TreeScanner.java:264)
                at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1891)
                at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
                at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:389)
                at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1367)
                at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scanExpr(Flow.java:1596)
                at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitApply(Flow.java:2204)
                at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1459)
                at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
                at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:389)
                at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1367)
                at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scanExpr(Flow.java:1596)
                at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scanExprs(Flow.java:1608)
                at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitApply(Flow.java:2205)
                at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1459)
        ....
        --------------------------------------------------


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Environment setup:
        set JAVA7_HOME to point to Java7
        set JAVA8_HOME to point to Java8

        Get the code:
        git clone https://github.com/BladeRunnerJS/brjs
        git checkout d8a4af2
        cd into 'brjs' folder
        execute 'gradlew compileJava'

        See that this command fails with the stack trace detailed in the description.

        If you checkout the commit prior to this:
        git checkout 4ac3238
        gradlew compileJava

        - see that this now passes

        The list of commits in this specific Pull Request can be found here:
        - https://github.com/BladeRunnerJS/brjs/pull/599


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Expected result is that there is no compilation error.
        ACTUAL -
        Java 1.8.0 Java compiler throws NullPointerException

        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        If I rename the class and prefix it with an 'X' (refactoring it via Eclipse) to 'XAbstractAssetLocation', the issue goes away for Windows 7, but still fails for Linux 64bit.


              pgovereau Paul Govereau (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: