Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StackOverFlowError during incremental Java compilation with annotation processors #11559

Open
Sipkab opened this issue Dec 4, 2019 · 0 comments
Open

Comments

@Sipkab
Copy link

@Sipkab Sipkab commented Dec 4, 2019

The following contains two issues, but I report them in a single issue due to being related to the same codebase. Feel free to create a separate issue for the compilation error part.

Expected Behavior

  1. When recompiling the project the incremental compilation should succeed.
  2. The project compilation should succeed.

Current Behavior

  1. The compilation results in a StackOverFlowError
  2. The compilation fails.

Context

I'm trying to compile the project with the included annotation processors:
annotation-processing-test.zip
The project contains generated files in the annottestgen directory. These sources are compiled with the presence of the annotation processors in processors.jar. The source for the annotation processors are in src_processors, I included a compiled version of them in the JAR.

There are two annotation processors:

ExtractProcessor: That extracts an interface definition based on the annotated methods. (isolating)
GroupProcessor: Creates a group class that aggregates the annotated types. (aggregating)

There's also a commented out part in testpackage0.TestClass1023 that removes a field definition. The groups.Group7 class is generated by the GroupProcessor in the last round of annotation processing and an appropriate constructor is added to it. However, the compilation fails.

Steps to Reproduce

Stackoverflow:
I'm using the path\to\gradle-6.0.1\bin\gradle.bat compileJava -i --stacktrace command

  1. Compile the project.
  2. Add a new line at the start of the testpackage0.TestClass1023 class.
  3. Run the compilation again, and fail with the following stacktrace:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileJava'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:187)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:185)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:166)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:374)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:361)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:354)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:340)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: java.lang.StackOverflowError
        at com.google.common.collect.Sets$1.size(Sets.java:669)
        at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:251)
        at org.gradle.api.internal.tasks.compile.incremental.deps.DependentsSet.dependents(DependentsSet.java:37)
        at org.gradle.api.internal.tasks.compile.incremental.deps.ClassSetAnalysis.getDependents(ClassSetAnalysis.java:169)
        at org.gradle.api.internal.tasks.compile.incremental.deps.ClassSetAnalysis.processDependentClasses(ClassSetAnalysis.java:151)
        at org.gradle.api.internal.tasks.compile.incremental.deps.ClassSetAnalysis.processDependentClasses(ClassSetAnalysis.java:154)
        at org.gradle.api.internal.tasks.compile.incremental.deps.ClassSetAnalysis.processDependentClasses(ClassSetAnalysis.java:154)
        at org.gradle.api.internal.tasks.compile.incremental.deps.ClassSetAnalysis.processDependentClasses(ClassSetAnalysis.java:154)
        at org.gradle.api.internal.tasks.compile.incremental.deps.ClassSetAnalysis.processDependentClasses(ClassSetAnalysis.java:154)
        at org.gradle.api.internal.tasks.compile.incremental.deps.ClassSetAnalysis.processDependentClasses(ClassSetAnalysis.java:154)
...

Compilation error:

  1. Uncomment the field definition in testpackage0.TestClass1023.
  2. Compile the project, and fail:
annottestgen\testpackage0\TestClass1023.java:7: error: package groups does not exist
        groups.Group7 group = new groups.Group7(this);
              ^

It shouldn't, as the generated file at build\generated\sources\annotationProcessor\java\main\groups\Group7.java contains an appropriate constructor: public Group7(testpackage0.TestClass1023 param) { } .

See the attached archive at Context.

Your Environment

------------------------------------------------------------
Gradle 6.0.1
------------------------------------------------------------

Build time:   2019-11-18 20:25:01 UTC
Revision:     fad1210

Kotlin:       1.3.50
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_221 (Oracle Corporation 25.221-b11)
OS:           Windows 10 10.0 amd64

The bugs are present in 5.1 and 5.6.4 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.