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

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 974af564eb4e0e0fe873b3ae0f80f0ed29d32da8
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Mar 18 19:50:00 2021 +0000

    Reproducible builds: XReflectionIntrospectionUtils.java
---
 .../util/xreflection/ObjectReflectionPropertyInspector.java |  3 ++-
 .../apache/tomcat/util/xreflection/ReflectionProperty.java  | 12 +++++++++++-
 .../apache/tomcat/util/xreflection/SetPropertyClass.java    | 13 +++++++++----
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git 
a/java/org/apache/tomcat/util/xreflection/ObjectReflectionPropertyInspector.java
 
b/java/org/apache/tomcat/util/xreflection/ObjectReflectionPropertyInspector.java
index dc101cb..f27a27f 100644
--- 
a/java/org/apache/tomcat/util/xreflection/ObjectReflectionPropertyInspector.java
+++ 
b/java/org/apache/tomcat/util/xreflection/ObjectReflectionPropertyInspector.java
@@ -26,6 +26,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -64,7 +65,7 @@ public final class ObjectReflectionPropertyInspector {
 
     private static final Set<Class<?>> getKnownClasses() throws 
ClassNotFoundException {
         return
-            Collections.unmodifiableSet(new HashSet<>(
+            Collections.unmodifiableSet(new LinkedHashSet<>(
                     Arrays.asList(
                         
Class.forName("org.apache.catalina.authenticator.jaspic.SimpleAuthConfigProvider"),
                         
Class.forName("org.apache.catalina.authenticator.jaspic.PersistentProviderRegistrations$Property"),
diff --git a/java/org/apache/tomcat/util/xreflection/ReflectionProperty.java 
b/java/org/apache/tomcat/util/xreflection/ReflectionProperty.java
index f74f7c0..46d4447 100644
--- a/java/org/apache/tomcat/util/xreflection/ReflectionProperty.java
+++ b/java/org/apache/tomcat/util/xreflection/ReflectionProperty.java
@@ -19,7 +19,7 @@ package org.apache.tomcat.util.xreflection;
 import java.lang.reflect.Method;
 import java.net.InetAddress;
 
-final class ReflectionProperty {
+final class ReflectionProperty implements Comparable<ReflectionProperty> {
     private final String clazz;
     private final String propertyName;
     private final Class<?> propertyType;
@@ -116,4 +116,14 @@ final class ReflectionProperty {
         sb.append('}');
         return sb.toString();
     }
+
+    @Override
+    public int compareTo(ReflectionProperty o) {
+        // Class then property name
+        int result = clazz.compareTo(o.clazz);
+        if (result == 0) {
+            result = propertyName.compareTo(o.propertyName);
+        }
+        return result;
+    }
 }
diff --git a/java/org/apache/tomcat/util/xreflection/SetPropertyClass.java 
b/java/org/apache/tomcat/util/xreflection/SetPropertyClass.java
index 55a68c4..389a483 100644
--- a/java/org/apache/tomcat/util/xreflection/SetPropertyClass.java
+++ b/java/org/apache/tomcat/util/xreflection/SetPropertyClass.java
@@ -18,12 +18,12 @@ package org.apache.tomcat.util.xreflection;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.util.HashSet;
 import java.util.Set;
+import java.util.TreeSet;
 
 import org.apache.tomcat.util.IntrospectionUtils;
 
-final class SetPropertyClass {
+final class SetPropertyClass implements Comparable<SetPropertyClass> {
 
     static final String OBJECT_VAR_NAME = "o";
     static final String NAME_VAR_NAME = "name";
@@ -32,8 +32,8 @@ final class SetPropertyClass {
 
     private final SetPropertyClass parent;
     private final Class<?> clazz;
-    private Set<SetPropertyClass> children = new HashSet<>();
-    private Set<ReflectionProperty> properties = new HashSet<>();
+    private Set<SetPropertyClass> children = new TreeSet<>();
+    private Set<ReflectionProperty> properties = new TreeSet<>();
     private final boolean isAbstract;
     private final Method genericSetPropertyMethod;
     private final Method genericGetPropertyMethod;
@@ -433,4 +433,9 @@ final class SetPropertyClass {
 
         return code.toString();
     }
+
+    @Override
+    public int compareTo(SetPropertyClass o) {
+        return clazz.getName().compareTo(o.clazz.getName());
+    }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to