This is an automated email from the ASF dual-hosted git repository.
paulk-asert pushed a commit to branch GROOVY_5_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_5_0_X by this push:
new ff64047145 GROOVY-12146: order reflection calls to ensure Annotation
members are ordered
ff64047145 is described below
commit ff64047145b3f9098ec344aa3efd4a228b9d861e
Author: James Daugherty <[email protected]>
AuthorDate: Fri Jul 10 15:17:28 2026 -0400
GROOVY-12146: order reflection calls to ensure Annotation members are
ordered
---
src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
b/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
index 18315879f5..d5c14b7f01 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
@@ -70,6 +70,7 @@ import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.security.Permission;
import java.util.Arrays;
+import java.util.Comparator;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
@@ -294,6 +295,9 @@ public class Java8 implements VMPlugin {
Method[] declaredMethods;
try {
declaredMethods = type.getDeclaredMethods();
+ // getDeclaredMethods does not guarantee an order, and
HotSpot's varies between JVM
+ // runs; sort so the annotation is emitted deterministically
for reproducible builds
+ Arrays.sort(declaredMethods,
Comparator.comparing(Method::getName));
} catch (SecurityException se) {
declaredMethods = EMPTY_METHOD_ARRAY;
}