Merge branch '5.3.x'

This commit is contained in:
Sam Brannen
2022-04-09 10:43:02 +02:00
7 changed files with 184 additions and 80 deletions

View File

@@ -854,6 +854,20 @@ public abstract class ClassUtils {
return (clazz.isMemberClass() && !isStaticClass(clazz));
}
/**
* Determine if the supplied {@link Class} is a JVM-generated implementation
* class for a lambda expression or method reference.
* <p>This method makes a best-effort attempt at determining this, based on
* checks that work on modern, mainstream JVMs.
* @param clazz the class to check
* @return {@code true} if the class is a lambda implementation class
* @since 5.3.19
*/
public static boolean isLambdaClass(Class<?> clazz) {
return (clazz.isSynthetic() && (clazz.getSuperclass() == Object.class) &&
(clazz.getInterfaces().length > 0) && clazz.getName().contains("$$Lambda"));
}
/**
* Check whether the given object is a CGLIB proxy.
* @param object the object to check