This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 2d34edd589 GROOVY-12146: order reflection calls to ensure Annotation 
members are ordered
2d34edd589 is described below

commit 2d34edd589c3fe6784c78aa7547fa131fa205373
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 85779ca049..ed551a2419 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
@@ -67,6 +67,7 @@ import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
 import java.lang.reflect.WildcardType;
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
 
 /**
@@ -284,6 +285,9 @@ public class Java8 implements VMPlugin {
             Method[] declaredMethods;
             try {
                 declaredMethods = 
annotation.annotationType().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;
             }

Reply via email to