Skip to content

Commit

Permalink
Address two more deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrail committed Jul 18, 2024
1 parent 5ca94cb commit 7feaad0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
5 changes: 2 additions & 3 deletions rhino/src/main/java/org/mozilla/javascript/JavaMembers.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ private void discoverAccessibleMethods(
if (isPublic(mods) || isProtected(mods) || includePrivate) {
MethodSignature sig = new MethodSignature(method);
if (!map.containsKey(sig)) {
if (includePrivate && !method.isAccessible())
method.setAccessible(true);
if (includePrivate) method.trySetAccessible();
map.put(sig, method);
}
}
Expand Down Expand Up @@ -667,7 +666,7 @@ private Field[] getAccessibleFields(boolean includeProtected, boolean includePri
for (Field field : declared) {
int mod = field.getModifiers();
if (includePrivate || isPublic(mod) || isProtected(mod)) {
if (!field.isAccessible()) field.setAccessible(true);
field.trySetAccessible();
fieldsList.add(field);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,7 @@ protected void setContext(Object contextHelper, Context cx) {

@Override
protected boolean tryToMakeAccessible(AccessibleObject accessible) {
if (accessible.isAccessible()) {
return true;
}
try {
accessible.setAccessible(true);
} catch (Exception ex) {
}

return accessible.isAccessible();
return accessible.trySetAccessible();
}

@Override
Expand Down

0 comments on commit 7feaad0

Please sign in to comment.