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

AntlrKotlinTask is not compatible with Gradle 8.12 #201

Closed
edwinRNDR opened this issue Dec 21, 2024 · 9 comments · Fixed by #203
Closed

AntlrKotlinTask is not compatible with Gradle 8.12 #201

edwinRNDR opened this issue Dec 21, 2024 · 9 comments · Fixed by #203

Comments

@edwinRNDR
Copy link

When using AntlrKotlinTask in a Gradle 8.12 project I run into the following exception:

Caused by: java.lang.NoSuchMethodError: 'org.gradle.process.internal.AbstractExecHandleBuilder org.gradle.process.internal.JavaExecHandleBuilder.redirectErrorStream()'
	at com.strumenta.antlrkotlin.gradle.internal.AntlrWorkerManager.createWorkerProcess(AntlrWorkerManager.kt:40)
	at com.strumenta.antlrkotlin.gradle.internal.AntlrWorkerManager.runWorker(AntlrWorkerManager.kt:17)
	at com.strumenta.antlrkotlin.gradle.AntlrKotlinTask.execute(AntlrKotlinTask.kt:145)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:45)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.execute(IncrementalTaskAction.java:26)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
	at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:244)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
	at org.gradle.api.internal.tasks.execution.TaskExecution.executeAction(TaskExecution.java:229)
	at org.gradle.api.internal.tasks.execution.TaskExecution.executeActions(TaskExecution.java:212)
	at org.gradle.api.internal.tasks.execution.TaskExecution.executeWithPreviousOutputFiles(TaskExecution.java:195)
	at org.gradle.api.internal.tasks.execution.TaskExecution.execute(TaskExecution.java:162)
	at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:105)
	at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:44)
	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:59)
	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:56)
@ftomassetti
Copy link
Member

Thank you for reporting this. We may specify which versions of gradle we support.
Would it be feasible for you to use gradle 8.8 for the time being?

@ftomassetti
Copy link
Member

I am also running into this issue

@ftomassetti
Copy link
Member

We may want to look into https://gradletest.ysb33r.org/gradletest/ to ensure the gradle plugin works with multiple versions of Gradle

@ftomassetti
Copy link
Member

@ftomassetti
Copy link
Member

@fcavro
Copy link

fcavro commented Dec 29, 2024

This is strange as the method causing the exception seems to be still there in the gradle codebase: https://github.com/gradle/gradle/blob/93844251a39b463e0d03b2b2853ae3acbca8bf50/subprojects/core/src/main/java/org/gradle/process/internal/JavaExecHandleBuilder.java#L462

In Gradle 8.12, the JavaExecHandleBuilder class no longer subclasses AbstractExecHandleBuilder, but the bytecode of AntlrWorkerManager still expects JavaExecHandleBuilder::redirectErrorStreamto return AbstractExecHandleBuilder (or at least as far as I understand it):

INVOKEVIRTUAL org/gradle/process/internal/JavaExecHandleBuilder.redirectErrorStream ()Lorg/gradle/process/internal/AbstractExecHandleBuilder;

@ftomassetti
Copy link
Member

Oh, good point @fcavro . I guess we could call the method through reflection

@ftomassetti
Copy link
Member

Release 1.0.2 is on its way, as this seems a problem worth to be solved asap

@lppedd
Copy link
Contributor

lppedd commented Jan 17, 2025

Perfect, thanks @ftomassetti

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants