You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by rm...@apache.org on 2022/01/26 16:08:01 UTC

[openwebbeans] branch master updated: [OWB-1401] sort intercepted methods

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

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 0d022c1  [OWB-1401] sort intercepted methods
0d022c1 is described below

commit 0d022c1ef8a76f02e4d7b3efe294ad877e2732a2
Author: Romain Manni-Bucau <rm...@gmail.com>
AuthorDate: Wed Jan 26 17:07:58 2022 +0100

    [OWB-1401] sort intercepted methods
---
 .../java/org/apache/webbeans/portable/AbstractProducer.java    | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java b/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
index 599c493..d2c0c1f 100644
--- a/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
+++ b/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
@@ -42,6 +42,8 @@ import org.apache.webbeans.intercept.InterceptorResolutionService.BeanIntercepto
 import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
 import org.apache.webbeans.proxy.OwbInterceptorProxy;
 
+import static java.util.Comparator.comparing;
+
 public abstract class AbstractProducer<T> implements Producer<T>
 {
 
@@ -99,8 +101,12 @@ public abstract class AbstractProducer<T> implements Producer<T>
 
             ClassLoader classLoader = webBeansContext.getApplicationBoundaryService().getBoundaryClassLoader(annotatedType.getJavaClass());
 
-            Method[] businessMethods = methodInterceptors.keySet().toArray(new Method[methodInterceptors.size()]);
-            Method[] nonInterceptedMethods = interceptorInfo.getNonInterceptedMethods().toArray(new Method[interceptorInfo.getNonInterceptedMethods().size()]);
+            Method[] businessMethods = methodInterceptors.keySet().stream()
+                    .sorted(comparing(Method::getName).thenComparing(Method::getParameterCount).thenComparing(Method::toGenericString))
+                    .toArray(Method[]::new);
+            Method[] nonInterceptedMethods = interceptorInfo.getNonInterceptedMethods().stream()
+                    .sorted(comparing(Method::getName).thenComparing(Method::getParameterCount).thenComparing(Method::toGenericString))
+                    .toArray(Method[]::new);
 
             proxyClass = (Class<? extends T>) pf.createProxyClass(bean, classLoader, annotatedType.getJavaClass(), businessMethods, nonInterceptedMethods);