Skip to content

Error compiling previously working project - NPE inside groovy compiler #1432

@ssadedin

Description

@ssadedin

I have a fairly large codebase that was working previously but now is failing to build with the latest groovy-eclipse.

When Eclipse tries to build the project, the following error is shown:

image

The error trace from the eclipse log is:

java.lang.NullPointerException: Cannot read the array length because "this.referenceContext.fields" is null
	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyClassScope.buildFieldsAndMethods(GroovyClassScope.java:418)
	at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildFieldsAndMethods(CompilationUnitScope.java:105)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:537)
	at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:894)
	at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:404)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:454)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:436)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:402)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:218)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:334)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:80)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:273)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1020)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:247)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:392)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:395)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:506)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:454)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:536)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:161)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:255)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

I am hoping this is enough context to investigate the problem. If not, I can try to narrow down what part of the code is causing this. I have other projects within the same workspace that do not experience this issue and build correctly. Hence I believe it's likely something to do with the specific code in one of the classes of the project.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions