-
Bug
-
Resolution: Won't Fix
-
Low
-
None
-
None
-
Severity 2 - Major
Environment Details
This bug occurs only on the following environment configuration:
- Windows machine
- IntelliJ Idea Ultimate Edition 2016.3
- JDK 1.6 and JDK 1.7
HTR
- Install Clover plugin to IntelliJ
- Run tests with using JDK 1.7 or JDK 1.6
Expected result
Tests are run, sources are instrumented and coverage is gathered properly.
Actual result
NullPointerException is thrown from compiler process:
Information:java: java.lang.NullPointerException Information:java: at com.atlassian.clover.idea.build.jps.CloverJavaSourceTransformer.transform(CloverJavaSourceTransformer.java:90) Information:java: at org.jetbrains.jps.javac.TransformableJavaFileObject.getCharContent(TransformableJavaFileObject.java:51) Information:java: at com.sun.tools.javac.main.JavaCompiler.readSource(JavaCompiler.java:483) Information:java: at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:550) Information:java: at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:804) Information:java: at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727) Information:java: at com.sun.tools.javac.main.Main.compile(Main.java:353) Information:java: at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:113) Information:java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:180) Information:java: at org.jetbrains.jps.javac.ExternalJavacProcess.compile(ExternalJavacProcess.java:189) Information:java: at org.jetbrains.jps.javac.ExternalJavacProcess.access$400(ExternalJavacProcess.java:48) Information:java: at org.jetbrains.jps.javac.ExternalJavacProcess$CompilationRequestsHandler$1.run(ExternalJavacProcess.java:254) Information:java: at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:44) Information:java: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) Information:java: at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) Information:java: at java.util.concurrent.FutureTask.run(FutureTask.java:138) Information:java: at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) Information:java: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) Information:java: at java.lang.Thread.run(Thread.java:662)
Workarounds
This bug seems to be related only with the specific environment configuration specified in the first point. The easiest workaround is to use newer JDK version.
Generally, the problem lies in the com.atlassian.clover.idea.build.jps.CloverJavaSourceTransformer#transform method when we reference to a CompileContext
CompileContext is set by ModuleLevelBuilder#buildStarted. This method should be technically called for every process but it looks like it's not on a Windows platform and JDK 1.6 and 1.7.
I spent some time on IntelliJ static analysis and debugging and I think it may be connected with a way how IntelliJ forks processes. Forking for JDK 1.8 and 1.9 is handled differently than forking 1.7 and older.