From 6f9d7da59ead04e65754ef0d13371ffb5ec8a0e7 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 7 Oct 2014 16:37:59 +0200 Subject: [PATCH] Consistent use of LinkedHashSet for interfaces (since interface order may matter in subtle cases) (cherry picked from commit 5a63117) --- .../main/java/org/springframework/aop/support/AopUtils.java | 6 +++--- .../aop/support/DefaultIntroductionAdvisor.java | 6 +++--- .../aop/support/IntroductionInfoSupport.java | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java index c99e219cc23..2729d82af1b 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ package org.springframework.aop.support; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; @@ -215,7 +215,7 @@ public abstract class AopUtils { introductionAwareMethodMatcher = (IntroductionAwareMethodMatcher) methodMatcher; } - Set> classes = new HashSet>(ClassUtils.getAllInterfacesForClassAsSet(targetClass)); + Set> classes = new LinkedHashSet>(ClassUtils.getAllInterfacesForClassAsSet(targetClass)); classes.add(targetClass); for (Class clazz : classes) { Method[] methods = clazz.getMethods(); diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java index 1353388aaaf..32af73dc7bc 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package org.springframework.aop.support; import java.io.Serializable; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.Set; import org.aopalliance.aop.Advice; @@ -43,7 +43,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil private final Advice advice; - private final Set> interfaces = new HashSet>(); + private final Set> interfaces = new LinkedHashSet>(); private int order = Integer.MAX_VALUE; diff --git a/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java b/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java index 05a3f722d63..b91c8975028 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import java.lang.reflect.Method; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -43,7 +43,7 @@ import org.springframework.util.ClassUtils; @SuppressWarnings("serial") public class IntroductionInfoSupport implements IntroductionInfo, Serializable { - protected final Set> publishedInterfaces = new HashSet>(); + protected final Set> publishedInterfaces = new LinkedHashSet>(); private transient Map rememberedMethods = new ConcurrentHashMap(32);