JDK-8189644 : NPE at Flow$FlowAnalyzer.visitNewClass(Flow.java 1245)
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8u91
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2017-10-18
  • Updated: 2017-12-02
  • Resolved: 2017-10-19
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
C:\>java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b15, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.15063]

EXTRA RELEVANT SYSTEM CONFIGURATION :
I was trying to build a Class that would create an instance of JerseyClient.

A DESCRIPTION OF THE PROBLEM :
the code I was compiling is:

package com.predictions3.client;
 
import org.glassfish.jersey.client.JerseyClient;
import org.glassfish.jersey.client.JerseyClientBuilder;
import org.glassfish.jersey.client.JerseyWebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Link;
import javax.ws.rs.core.Response;

import predictions3.Prediction;



public class PredictionsJersey2Client {

 private static final String REST_URI = "http://localhost:8080/predictions3/resourcesP/";

    private JerseyClient client = new JerseyClient();
   
    public static void main(String args) {
		PredictionsJersey2Client donut = new PredictionsJersey2Client();
		Prediction pred = donut.getXmlPrediction(2); 
		System.out.print(pred);
	}

    public Prediction getXmlPrediction(int id) {
		return client.target(REST_URI).path(String.valueOf(id)).request(MediaType.APPLICATION_XML).get(Prediction.class);
    }
}


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.  import relevant classes as shown above

2.  define a custom Java Class ( standalone)  that attempts to run a Jersey2 Client instance.

Note:  This compiler bug only happens when I try to compile a custom .java file.  The compiler works fine in all other attempts to compile other source code.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected a Java Class file to be created.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
C:\DEV\RESTful WS Projects\Predictions_Client\com\predictions3>
C:\DEV\RESTful WS Projects\Predictions_Client\com\predictions3>javac PredictionsJersey2Client.java
An exception has occurred in the compiler (1.8.0_91). 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.
java.lang.NullPointerException
        at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitNewClass(Flow.java:1245)
        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:404)
        at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitVarDef(Flow.java:991)
        at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:852)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
        at com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitClassDef(Flow.java:904)
        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:404)
        at com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1329)
        at com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1319)
        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:56)
        at com.sun.tools.javac.Main.main(Main.java:42)


REPRODUCIBILITY :
This bug can be reproduced rarely.


Comments
This issue is duplicate of JDK-8065986 which has been already fixed in 9 and backported to 8u92 and higher versions. You are using JDK 8u91, Kindly upgrade to use latest version to avoid this issue.
19-10-2017