Apply name-matching transaction attributes to user-level methods only
In particular, do not apply them to GroovyObject methods and other kinds of synthetic methods in language runtimes. The only exception are bridge methods since those do eventually point to a user-level generic method. Issue: SPR-10803
This commit is contained in:
@@ -766,12 +766,28 @@ public abstract class ClassUtils {
|
||||
return method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the given method is declared by the user or at least pointing to
|
||||
* a user-declared method.
|
||||
* <p>Checks {@link Method#isSynthetic()} (for implementation methods) as well as the
|
||||
* {@code GroovyObject} interface (for interface methods; on an implementation class,
|
||||
* implementations of the {@code GroovyObject} methods will be marked as synthetic anyway).
|
||||
* Note that, despite being synthetic, bridge methods ({@link Method#isBridge()}) are considered
|
||||
* as user-level methods since they are eventually pointing to a user-declared generic method.
|
||||
* @param method the method to check
|
||||
* @return {@code true} if the method can be considered as user-declared; [@code false} otherwise
|
||||
*/
|
||||
public static boolean isUserLevelMethod(Method method) {
|
||||
return (method.isBridge() ||
|
||||
(!method.isSynthetic() && !method.getDeclaringClass().getName().equals("groovy.lang.GroovyObject")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the given method is overridable in the given target class.
|
||||
* @param method the method to check
|
||||
* @param targetClass the target class to check against
|
||||
*/
|
||||
private static boolean isOverridable(Method method, Class targetClass) {
|
||||
private static boolean isOverridable(Method method, Class<?> targetClass) {
|
||||
if (Modifier.isPrivate(method.getModifiers())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user