groovy / groovy/groovy-eclipse

Compile problem

Open
#1,700 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
681
Forks
197
PR merge metrics
No merged PRs in 30d

Description

I opened Spock and let it build.

For each of the projects boot2-test, boot3-test, mock-integration, spring3-test, spring5-test, spring6-test, spring7-test I got an error reported saying

Transform org.spockframework.compiler.SpockTransform cannot be run

without any further information I can find.

Setting a breakpoint in the org.codehaus.groovy.control.messages.ExceptionMessage.write method I was able to drag out this stack trace when modifying for example the org.spockframework.boot2.DataJpaTestIntegrationSpec file and saving it to trigger its recompilation:

org.codehaus.groovy.GroovyException: Transform org.spockframework.compiler.SpockTransform cannot be run
	at org.codehaus.groovy.transform.ASTTransformationVisitor.lambda$5(ASTTransformationVisitor.java:468)
	at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:939)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:678)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:652)
	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:243)
	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.resolve(GroovyCompilationUnitDeclaration.java:639)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:833)
	at org.eclipse.jdt.internal.compiler.ProcessTaskManager.processing(ProcessTaskManager.java:135)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
	at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.spockframework.compiler.SpockTransform$Impl
	at org.spockframework.compiler.SpockTransform.visit(SpockTransform.java:48)
	at org.codehaus.groovy.transform.ASTTransformationVisitor.lambda$5(ASTTransformationVisitor.java:453)
	... 12 more
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: Unable to configure org.spockframework.runtime.SpockRuntime due to missing dependency org/opentest4j/MultipleFailuresError [in thread "Worker-17: Refresh DSLD scripts"]
	at org.codehaus.groovy.vmplugin.v8.Java8.configureClassNode(Java8.java:461)
	at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:345)
	at org.codehaus.groovy.ast.ClassNode.getDeclaredMethods(ClassNode.java:976)
	at org.codehaus.groovy.ast.ImmutableClassNode.getDeclaredMethods(ImmutableClassNode.java:122)
	at org.spockframework.compiler.AstNodeCache.<init>(AstNodeCache.java:57)
	at org.spockframework.compiler.SpockTransform$Impl.<clinit>(SpockTransform.java:53)
	at org.spockframework.compiler.SpockTransform.visit(SpockTransform.java:48)
	at org.codehaus.groovy.transform.ASTTransformationVisitor.lambda$5(ASTTransformationVisitor.java:453)
	at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:939)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:678)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:652)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:365)
	at groovy.lang.GroovyClassLoader.lambda$parseClass$2(GroovyClassLoader.java:314)
	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:298)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:263)
	at org.codehaus.groovy.eclipse.dsl.script.DSLDScriptExecutor.executeScript(DSLDScriptExecutor.java:77)
	at org.codehaus.groovy.eclipse.dsl.RefreshDSLDJob.refreshProject(RefreshDSLDJob.java:189)
	at org.codehaus.groovy.eclipse.dsl.RefreshDSLDJob.run(RefreshDSLDJob.java:118)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Here I wonder about multiple things, for example:

  • Why is org.opentest4j.MultipleFailuresError not found? As far as I can see it is correctly there as library in the build path of those projects
  • Why is it happening in the "Refresh DSLD scripts" worker when actually compiling the class, not the DSLD (the CompilationUnitDeclaration shows the source of the test file)
  • Why is it not happening for all projects? For spock-specs it could be because of #1699, but also others work like spock-unitils

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by editing org.spockframework.boot2.DataJpaTestIntegrationSpec in one of the listed test projects and inspect the stack from SpockTransform through SpockRuntime and the missing MultipleFailuresError dependency. Compare the working and failing projects, then trace why RefreshDSLDJob invokes this compilation path. Done means identifying the dependency or class-loading cause and explaining the project-specific and worker-context differences.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.