This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new c35e292059 Disable Groovy invokedynamic compilation
c35e292059 is described below
commit c35e2920594a17ed37c5815c58ddf3c8fc2003b7
Author: James Netherton <[email protected]>
AuthorDate: Thu Feb 5 09:09:35 2026 +0000
Disable Groovy invokedynamic compilation
Fixes #8122
---
.../ROOT/pages/reference/extensions/groovy.adoc | 9 +++++++++
.../groovy/deployment/GroovyProcessor.java | 22 +++++++++++++---------
.../groovy/runtime/src/main/doc/limitations.adoc | 8 ++++++++
.../quarkus/component/groovy/it/GroovyIT.java | 2 --
4 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/docs/modules/ROOT/pages/reference/extensions/groovy.adoc
b/docs/modules/ROOT/pages/reference/extensions/groovy.adoc
index 75474be117..a6bd6fb1a8 100644
--- a/docs/modules/ROOT/pages/reference/extensions/groovy.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/groovy.adoc
@@ -76,3 +76,12 @@ from("direct:start")
`greeting.message` will be evaluated once at build time and its value will be
permanently stored in the native image.
It is not possible to override the value of the property at runtime.
Attempting to do so will result in an exception being thrown.
+[id="extensions-groovy-limitations-invokedynamic-support-in-native-mode"]
+==== InvokeDynamic support in native mode
+
+This extension disables Groovy
https://docs.groovy-lang.org/next/html/documentation/invokedynamic-support.html[InvokeDynamic]
support during script compilation.
+
+Please note that if scripts or their dependencies make any explicit reference
to `InvokeDynamic`, they will not work since the underlying logic required to
support the feature is not available in GraalVM / Mandrel >= 25
+
+`InvokeDynamic` support in JVM mode is not affected and remains enabled.
+
diff --git
a/extensions/groovy/deployment/src/main/java/org/apache/camel/quarkus/component/groovy/deployment/GroovyProcessor.java
b/extensions/groovy/deployment/src/main/java/org/apache/camel/quarkus/component/groovy/deployment/GroovyProcessor.java
index 659f7797ab..136a111d2e 100644
---
a/extensions/groovy/deployment/src/main/java/org/apache/camel/quarkus/component/groovy/deployment/GroovyProcessor.java
+++
b/extensions/groovy/deployment/src/main/java/org/apache/camel/quarkus/component/groovy/deployment/GroovyProcessor.java
@@ -123,7 +123,18 @@ class GroovyProcessor {
if (sources.isEmpty()) {
return;
}
- CompilationUnit unit = new CompilationUnit();
+
+ CompilerConfiguration configuration = new CompilerConfiguration();
+ // Disable InvokeDynamic because it triggers code paths to GraalVM
deleted MethodHandleNatives.setCallSiteTargetNormal
+
configuration.getOptimizationOptions().put(CompilerConfiguration.INVOKEDYNAMIC,
Boolean.FALSE);
+ configuration.setClasspathList(
+
curateOutcomeBuildItem.getApplicationModel().getDependencies().stream()
+ .map(ResolvedDependency::getResolvedPaths)
+ .flatMap(PathCollection::stream)
+ .map(Objects::toString)
+ .toList());
+
+ CompilationUnit unit = new CompilationUnit(configuration);
Set<String> classNames = new HashSet<>();
for (GroovyExpressionSourceBuildItem source : sources) {
String name = source.getClassName();
@@ -134,14 +145,7 @@ class GroovyProcessor {
unit.addSource(name, content);
classNames.add(name);
}
- CompilerConfiguration cc = new CompilerConfiguration();
- cc.setClasspathList(
-
curateOutcomeBuildItem.getApplicationModel().getDependencies().stream()
- .map(ResolvedDependency::getResolvedPaths)
- .flatMap(PathCollection::stream)
- .map(Objects::toString)
- .toList());
- unit.configure(cc);
+ unit.configure(configuration);
unit.compile(Phases.CLASS_GENERATION);
for (GroovyClass clazz : unit.getClasses()) {
String className = clazz.getName();
diff --git a/extensions/groovy/runtime/src/main/doc/limitations.adoc
b/extensions/groovy/runtime/src/main/doc/limitations.adoc
index a1ee823550..352818b41c 100644
--- a/extensions/groovy/runtime/src/main/doc/limitations.adoc
+++ b/extensions/groovy/runtime/src/main/doc/limitations.adoc
@@ -24,3 +24,11 @@ from("direct:start")
`greeting.message` will be evaluated once at build time and its value will be
permanently stored in the native image.
It is not possible to override the value of the property at runtime.
Attempting to do so will result in an exception being thrown.
+
+==== InvokeDynamic support in native mode
+
+This extension disables Groovy
https://docs.groovy-lang.org/next/html/documentation/invokedynamic-support.html[InvokeDynamic]
support during script compilation.
+
+Please note that if scripts or their dependencies make any explicit reference
to `InvokeDynamic`, they will not work since the underlying logic required to
support the feature is not available in GraalVM / Mandrel >= 25
+
+`InvokeDynamic` support in JVM mode is not affected and remains enabled.
diff --git
a/integration-tests/groovy/src/test/java/org/apache/camel/quarkus/component/groovy/it/GroovyIT.java
b/integration-tests/groovy/src/test/java/org/apache/camel/quarkus/component/groovy/it/GroovyIT.java
index 4c6250fd19..68c7733865 100644
---
a/integration-tests/groovy/src/test/java/org/apache/camel/quarkus/component/groovy/it/GroovyIT.java
+++
b/integration-tests/groovy/src/test/java/org/apache/camel/quarkus/component/groovy/it/GroovyIT.java
@@ -16,10 +16,8 @@
*/
package org.apache.camel.quarkus.component.groovy.it;
-import io.quarkus.test.junit.DisabledOnIntegrationTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;
-@DisabledOnIntegrationTest("https://github.com/apache/camel-quarkus/issues/8122")
@QuarkusIntegrationTest
class GroovyIT extends GroovyTest {