Occasional :compileJava task failures due to compiler crash

I am getting some javac crashes occasionally and am wondering if this could have anything to do with Gradle or if anyone else has experienced this. At first I thought it was due to this compiler bug (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7073508) but the error is different from that. Based on the following stack trace segment maybe the classpath is getting messed up somehow? Thanks for any input on this issue.

Also, I forgot to mention – whenever this error occurs, I can simply rerun the build and it will succeed. Then maybe it will be several more days until it happens again. Very strange.

Caused by: java.lang.NullPointerException
 at com.sun.tools.javac.file.BaseFileObject.removeExtension(BaseFileObject.java:95)
 at com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject.inferBinaryName(ZipFileIndexArchive.java:224)
 at com.sun.tools.javac.file.JavacFileManager.inferBinaryName(JavacFileManager.java:670)
 at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2536)

And here is my Gradle information:

------------------------------------------------------------
Gradle 1.3
------------------------------------------------------------
  Gradle build time: Tuesday, November 20, 2012 11:37:38 AM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.7.0 (IBM Corporation 2.6)
OS: Linux 2.6.32-279.19.1.el6.x86_64 amd64

Here is the full stacktrace:

:compileJava
An exception has occurred in the compiler (1.7.0-internal). 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.AssertionError: java.lang.NullPointerException
 at com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue(Symbol.java:1023)
 at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:881)
 at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:737)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:443)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:430)
 at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:492)
 at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:508)
 at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:923)
 at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:793)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:443)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:430)
 at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:492)
 at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:841)
 at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:681)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:443)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:430)
 at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:492)
 at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:3253)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3176)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3112)
 at com.sun.tools.javac.comp.Attr.attrib(Attr.java:3086)
 at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1196)
 at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:882)
 at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:841)
 at com.sun.tools.javac.main.Main.compile(Main.java:451)
 at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:144)
 at org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler.execute(Jdk6JavaCompiler.java:40)
 at org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler.execute(Jdk6JavaCompiler.java:33)
 at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:95)
 at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:48)
 at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:34)
 at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:29)
 at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:20)
 at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:33)
 at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:23)
 at org.gradle.api.tasks.compile.Compile.compile(Compile.java:68)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
 at java.lang.reflect.Method.invoke(Method.java:613)
 at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
 at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
 at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1047)
 at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
 at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
 at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)
 at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
 at org.gradle.api.tasks.compile.JavaCompile_Decorated.invokeMethod(Unknown Source)
 at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
 at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
 at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:161)
 at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:156)
 at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:472)
 at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:461)
 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60)
 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
 at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
 at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)
 at org.gradle.internal.Factories$1.create(Factories.java:22)
 at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:179)
 at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:232)
 at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:138)
 at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
 at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)
 at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
 at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
 at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
 at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
 at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
 at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
 at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)
 at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:52)
 at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:38)
 at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:30)
 at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
 at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
 at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
 at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
 at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
 at org.gradle.internal.Factories$1.create(Factories.java:22)
 at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
 at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
 at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:130)
 at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
 at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
 at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
 at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
 at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
 at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:158)
 at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
 at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
 at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
 at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
 at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
 at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
 at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:137)
 at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
 at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
 at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
 at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
 at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
 at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
 at org.gradle.launcher.Main.doAction(Main.java:48)
 at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
 at org.gradle.launcher.Main.main(Main.java:39)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
 at java.lang.reflect.Method.invoke(Method.java:613)
 at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
 at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
 at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: java.lang.NullPointerException
 at com.sun.tools.javac.file.BaseFileObject.removeExtension(BaseFileObject.java:95)
 at com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject.inferBinaryName(ZipFileIndexArchive.java:224)
 at com.sun.tools.javac.file.JavacFileManager.inferBinaryName(JavacFileManager.java:670)
 at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2536)
 at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2504)
 at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:2155)
 at com.sun.tools.javac.code.Symbol.complete(Symbol.java:433)
 at com.sun.tools.javac.jvm.ClassReader.completeOwners(ClassReader.java:2167)
 at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:2146)
 at com.sun.tools.javac.code.Symbol.complete(Symbol.java:433)
 at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:833)
 at com.sun.tools.javac.code.Type$ClassType.complete(Type.java:735)
 at com.sun.tools.javac.code.Type$ClassType.getTypeArguments(Type.java:663)
 at com.sun.tools.javac.code.Types$Subst.visitClassType(Types.java:2319)
 at com.sun.tools.javac.code.Types$Subst.visitClassType(Types.java:2248)
 at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:595)
 at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3804)
 at com.sun.tools.javac.code.Types$Subst.subst(Types.java:2271)
 at com.sun.tools.javac.code.Types$Subst.subst(Types.java:2279)
 at com.sun.tools.javac.code.Types$Subst.subst(Types.java:2280)
 at com.sun.tools.javac.code.Types$Subst.visitMethodType(Types.java:2295)
 at com.sun.tools.javac.code.Types$Subst.visitMethodType(Types.java:2248)
 at com.sun.tools.javac.code.Type$MethodType.accept(Type.java:892)
 at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3804)
 at com.sun.tools.javac.code.Types$Subst.subst(Types.java:2271)
 at com.sun.tools.javac.code.Types.subst(Types.java:2245)
 at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:383)
 at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:699)
 at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:961)
 at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:922)
 at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:1475)
 at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:2401)
 at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:2286)
 at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1689)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:443)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:430)
 at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:461)
 at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1526)
 at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1333)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:443)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:430)
 at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:461)
 at com.sun.tools.javac.comp.Attr.attribLazyConstantValue(Attr.java:623)
 at com.sun.tools.javac.code.Symbol$VarSymbol$1.call(Symbol.java:989)
 at com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue(Symbol.java:1021)
 ... 115 more
:compileJava FAILED

You are using an IBM JDK, so you might have to hunt for IBM JDK bugs.