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

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

commit f8f68cc0e1821f03a39f8020694f76565ea40108
Author: Richard Zowalla <[email protected]>
AuthorDate: Wed Jul 8 21:03:01 2026 +0200

    OWB-1465 - Extract shared PROXYABLE_METHOD_MODIFIERS constant (review 
feedback)
    
    Replace the four inlined modifier masks in NormalScopeProxyFactory and
    InterceptorDecoratorProxyFactory with a single documented constant in
    AbstractProxyFactory. No behavioural change for the interceptor proxy
    paths: bridge methods never reach them (unproxyableMethod skips them),
    and synthetic non-bridge methods (lambda$, access$) are private or
    static and filtered out before generation.
---
 .../java/org/apache/webbeans/proxy/AbstractProxyFactory.java   | 10 ++++++++++
 .../webbeans/proxy/InterceptorDecoratorProxyFactory.java       |  4 ++--
 .../org/apache/webbeans/proxy/NormalScopeProxyFactory.java     | 10 ++--------
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git 
a/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
 
b/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
index 5dba228bc..c5f52cdc6 100644
--- 
a/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
+++ 
b/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
@@ -75,6 +75,16 @@ public abstract class AbstractProxyFactory
      */
     public static final int MODIFIER_SYNTHETIC = 0x00001000;
 
+    /**
+     * The method modifiers a generated proxy keeps when re-declaring a method 
of the proxied class;
+     * everything else (e.g. ABSTRACT, SYNCHRONIZED, NATIVE) must not appear 
on a generated
+     * delegation method. ACC_BRIDGE / ACC_SYNTHETIC are preserved so that 
overload resolution
+     * (e.g. jakarta.el MethodExpressions on proxied beans) can still detect 
re-declared JVM bridge
+     * methods via {@link Method#isBridge()}.
+     */
+    public static final int PROXYABLE_METHOD_MODIFIERS =
+            Modifier.PUBLIC | Modifier.PROTECTED | MODIFIER_VARARGS | 
MODIFIER_BRIDGE | MODIFIER_SYNTHETIC;
+
     protected final Unsafe unsafe;
 
     private final DefiningClassService definingService;
diff --git 
a/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
 
b/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
index 8defa2279..2fa944d48 100644
--- 
a/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
+++ 
b/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
@@ -355,7 +355,7 @@ public class InterceptorDecoratorProxyFactory extends 
AbstractProxyFactory
                 exceptionTypeNames[i] = 
Type.getType(exceptionTypes[i]).getInternalName();
             }
 
-            int targetModifiers = modifiers & (Modifier.PROTECTED | 
Modifier.PUBLIC | MODIFIER_VARARGS);
+            int targetModifiers = modifiers & PROXYABLE_METHOD_MODIFIERS;
 
             MethodVisitor mv = cw.visitMethod(targetModifiers, 
delegatedMethod.getName(), methodDescriptor, null, exceptionTypeNames);
 
@@ -423,7 +423,7 @@ public class InterceptorDecoratorProxyFactory extends 
AbstractProxyFactory
         }
 
         // push the method definition
-        int modifier = modifiers & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED 
| Opcodes.ACC_VARARGS);
+        int modifier = modifiers & PROXYABLE_METHOD_MODIFIERS;
 
         MethodVisitor mv = cw.visitMethod(modifier, method.getName(), 
Type.getMethodDescriptor(method), null, null);
         mv.visitCode();
diff --git 
a/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
 
b/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
index 0756b237d..f31ddc319 100644
--- 
a/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
+++ 
b/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
@@ -395,10 +395,7 @@ public class NormalScopeProxyFactory extends 
AbstractProxyFactory
                 exceptionTypeNames[i] = 
Type.getType(exceptionTypes[i]).getInternalName();
             }
 
-            // preserve ACC_BRIDGE | ACC_SYNTHETIC on re-declared JVM bridge 
methods: overload resolution
-            // (e.g. jakarta.el MethodExpressions on proxied beans) relies on 
Method#isBridge() to disambiguate
-            int targetModifiers = delegatedMethod.getModifiers()
-                    & (Modifier.PROTECTED | Modifier.PUBLIC | MODIFIER_VARARGS 
| MODIFIER_BRIDGE | MODIFIER_SYNTHETIC);
+            int targetModifiers = delegatedMethod.getModifiers() & 
PROXYABLE_METHOD_MODIFIERS;
 
             MethodVisitor mv = cw.visitMethod(targetModifiers, 
delegatedMethod.getName(), methodDescriptor, null, exceptionTypeNames);
 
@@ -457,10 +454,7 @@ public class NormalScopeProxyFactory extends 
AbstractProxyFactory
         int modifiers = method.getModifiers();
 
         // push the method definition
-        // preserve ACC_BRIDGE | ACC_SYNTHETIC on re-declared JVM bridge 
methods: overload resolution
-        // (e.g. jakarta.el MethodExpressions on proxied beans) relies on 
Method#isBridge() to disambiguate
-        int modifier = modifiers
-                & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | 
Opcodes.ACC_VARARGS | Opcodes.ACC_BRIDGE | Opcodes.ACC_SYNTHETIC);
+        int modifier = modifiers & PROXYABLE_METHOD_MODIFIERS;
 
         MethodVisitor mv = cw.visitMethod(modifier, method.getName(), 
Type.getMethodDescriptor(method), null, null);
         mv.visitCode();

Reply via email to