ADDITIONAL SYSTEM INFORMATION :
Windows 10, JDK 10.0.2, IntelliJ IDEA 2018.2.5
A DESCRIPTION OF THE PROBLEM :
package aaa
import org.springframework.core.ParameterizedTypeReference;
public class Bug {
public static class Pojo{
}
public static class GenericPojo<T>{
}
public GenericPojo<Pojo> getPojo(){
// GenericPojo<Pojo> gp = doGet(new ParameterizedTypeReference<GenericPojo<Pojo>>() {});
GenericPojo<Pojo> gp = doGet(new ParameterizedTypeReference<>() {});
return gp;
}
public static <T> T doGet(ParameterizedTypeReference<T> typeReference){
return null;
}
}
REGRESSION : Last worked in version 10.0.2
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
create a spring project and insert a new class, which use ParameterizedTypeReference
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
compile success
ACTUAL -
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:1634)
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:396)
Information:java: at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitVarDef(Flow.java:987)
Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:956)
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:1020)
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:216)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1393)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1367)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:965)
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:193)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:448)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:318)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:243)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:201)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1317)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:993)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1065)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:956)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:788)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:377)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:184)
Information:java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
Information:java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:309)
Information:java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:137)
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:1135)
Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
Information:java: at java.base/java.lang.Thread.run(Thread.java:844)
Information:java: Errors occurred while compiling module 'web'
Information:javac 10.0.2 was used to compile java sources
Information:2018/10/17 14:35 - Compilation completed with 1 error and 0 warnings in 1 s 475 ms
Error:java: Compilation failed: internal java compiler error
---------- BEGIN SOURCE ----------
package aaa
import org.springframework.core.ParameterizedTypeReference;
public class Bug {
public static class Pojo{
}
public static class GenericPojo<T>{
}
public GenericPojo<Pojo> getPojo(){
// GenericPojo<Pojo> gp = doGet(new ParameterizedTypeReference<GenericPojo<Pojo>>() {});
GenericPojo<Pojo> gp = doGet(new ParameterizedTypeReference<>() {});
return gp;
}
public static <T> T doGet(ParameterizedTypeReference<T> typeReference){
return null;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
replace with :
GenericPojo<Pojo> gp = doGet(new ParameterizedTypeReference<GenericPojo<Pojo>>() {});
FREQUENCY : always
Windows 10, JDK 10.0.2, IntelliJ IDEA 2018.2.5
A DESCRIPTION OF THE PROBLEM :
package aaa
import org.springframework.core.ParameterizedTypeReference;
public class Bug {
public static class Pojo{
}
public static class GenericPojo<T>{
}
public GenericPojo<Pojo> getPojo(){
// GenericPojo<Pojo> gp = doGet(new ParameterizedTypeReference<GenericPojo<Pojo>>() {});
GenericPojo<Pojo> gp = doGet(new ParameterizedTypeReference<>() {});
return gp;
}
public static <T> T doGet(ParameterizedTypeReference<T> typeReference){
return null;
}
}
REGRESSION : Last worked in version 10.0.2
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
create a spring project and insert a new class, which use ParameterizedTypeReference
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
compile success
ACTUAL -
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:1634)
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:396)
Information:java: at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitVarDef(Flow.java:987)
Information:java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:956)
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:1020)
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:216)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1393)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1367)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:965)
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:193)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:448)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:318)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:243)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:201)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1317)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:993)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1065)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:956)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:788)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:377)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:184)
Information:java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
Information:java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:309)
Information:java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:137)
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:1135)
Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
Information:java: at java.base/java.lang.Thread.run(Thread.java:844)
Information:java: Errors occurred while compiling module 'web'
Information:javac 10.0.2 was used to compile java sources
Information:2018/10/17 14:35 - Compilation completed with 1 error and 0 warnings in 1 s 475 ms
Error:java: Compilation failed: internal java compiler error
---------- BEGIN SOURCE ----------
package aaa
import org.springframework.core.ParameterizedTypeReference;
public class Bug {
public static class Pojo{
}
public static class GenericPojo<T>{
}
public GenericPojo<Pojo> getPojo(){
// GenericPojo<Pojo> gp = doGet(new ParameterizedTypeReference<GenericPojo<Pojo>>() {});
GenericPojo<Pojo> gp = doGet(new ParameterizedTypeReference<>() {});
return gp;
}
public static <T> T doGet(ParameterizedTypeReference<T> typeReference){
return null;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
replace with :
GenericPojo<Pojo> gp = doGet(new ParameterizedTypeReference<GenericPojo<Pojo>>() {});
FREQUENCY : always
- duplicates
-
JDK-8210197 javac can't tell during speculative attribution if a diamond expression is creating an anonymous inner class or not
- Resolved