Skip to content

Commit

Permalink
Trivial refactoring: extract variables
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellansun committed Jan 11, 2025
1 parent 90e8be8 commit 9e1f90c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/org/codehaus/groovy/reflection/CachedClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ private static <T> T doPrivileged(java.security.PrivilegedAction<T> action) {
}

private static <M extends AccessibleObject & Member> boolean isAccessibleOrCanSetAccessible(M m) {
if (isPublic(m.getModifiers()) && m.getDeclaringClass().getPackageName().startsWith("sun.")) {
final int modifiers = m.getModifiers();
final Class<?> declaringClass = m.getDeclaringClass();
if (isPublic(modifiers) && declaringClass.getPackageName().startsWith("sun.")) {
return false;
}
if (isProtected(m.getModifiers()) && isPublic(m.getDeclaringClass().getModifiers())) {
if (isProtected(modifiers) && isPublic(declaringClass.getModifiers())) {
return true;
}
return ReflectionUtils.checkCanSetAccessible(m, CachedClass.class);
Expand Down

0 comments on commit 9e1f90c

Please sign in to comment.