File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
spring-core/src/main/java/org/springframework/util Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 63
63
* @author Keith Donald
64
64
* @author Rob Harrop
65
65
* @author Sam Brannen
66
+ * @author Sebastien Deleuze
66
67
* @since 1.1
67
68
* @see TypeUtils
68
69
* @see ReflectionUtils
@@ -96,6 +97,12 @@ public abstract class ClassUtils {
96
97
/** The ".class" file suffix. */
97
98
public static final String CLASS_FILE_SUFFIX = ".class" ;
98
99
100
+ /** Precomputed value for the combination of private, static and final modifiers. */
101
+ private static final int NON_OVERRIDABLE_MODIFIER = Modifier .PRIVATE | Modifier .STATIC | Modifier .FINAL ;
102
+
103
+ /** Precomputed value for the combination of public and protected modifiers. */
104
+ private static final int OVERRIDABLE_MODIFIER = Modifier .PUBLIC | Modifier .PROTECTED ;
105
+
99
106
100
107
/**
101
108
* Map with primitive wrapper type as key and corresponding primitive
@@ -1448,10 +1455,10 @@ private static boolean isGroovyObjectMethod(Method method) {
1448
1455
* @param targetClass the target class to check against
1449
1456
*/
1450
1457
private static boolean isOverridable (Method method , @ Nullable Class <?> targetClass ) {
1451
- if (Modifier . isPrivate (method .getModifiers ()) ) {
1458
+ if ((method .getModifiers () & NON_OVERRIDABLE_MODIFIER ) != 0 ) {
1452
1459
return false ;
1453
1460
}
1454
- if (Modifier . isPublic (method .getModifiers ()) || Modifier . isProtected ( method . getModifiers ()) ) {
1461
+ if ((method .getModifiers () & OVERRIDABLE_MODIFIER ) != 0 ) {
1455
1462
return true ;
1456
1463
}
1457
1464
return (targetClass == null ||
You can’t perform that action at this time.
0 commit comments