Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/tools/jackson/databind/MapperFeature.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public enum MapperFeature
* Feature that determines whether method and field access
* modifier settings can be overridden when accessing
* properties. If enabled, method
* {@link java.lang.reflect.AccessibleObject#setAccessible}
* {@link java.lang.reflect.AccessibleObject#trySetAccessible}
* may be called to enable access to otherwise unaccessible objects.
*<p>
* Note that this setting may have significant performance implications,
Expand All @@ -227,7 +227,7 @@ public enum MapperFeature

/**
* Feature that determines that forces call to
* {@link java.lang.reflect.AccessibleObject#setAccessible} even for
* {@link java.lang.reflect.AccessibleObject#trySetAccessible} even for
* <code>public</code> accessors -- that is, even if no such call is
* needed from functionality perspective -- if call is allowed
* (that is, {@link #CAN_OVERRIDE_ACCESS_MODIFIERS} is set to true).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Stream<Annotation> annotations() {

/**
* Method that can be called to modify access rights, by calling
* {@link java.lang.reflect.AccessibleObject#setAccessible} on
* {@link java.lang.reflect.AccessibleObject#trySetAccessible} on
* the underlying annotated element.
*<p>
* Note that caller should verify that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private void _addMemberMethods(TypeResolutionContext tc,
// may also result in faster method calls (interface calls are slightly
// costlier than regular method calls)
// 03-Jan-2021, scs: But we should probably prefer more public interface methods
// (and respect class visibility too!) rather than relying on setAccessible
// (and respect class visibility too!) rather than relying on `trySetAccessible`
private boolean shouldReplace(Method current, Method replace) {
if (accessLevel(replace) > accessLevel(current)) {
return true;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/tools/jackson/databind/util/ClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,9 @@ public static Class<?> primitiveType(Class<?> type)
/**
* Method that is called if a {@link Member} may need forced access,
* to force a field, method or constructor to be accessible: this
* is done by calling {@link AccessibleObject#setAccessible(boolean)}.
* is done by calling {@link AccessibleObject#trySetAccessible}.
*
* @param member Accessor to call <code>setAccessible()</code> on.
* @param member Accessor to call <code>trySetAccessible()</code> on.
* @param evenIfAlreadyPublic Whether to always try to make accessor
* accessible, even if {@code public} (true),
* or only if needed to force by-pass of non-{@code public} access (false)
Expand All @@ -863,7 +863,7 @@ public static void checkAndFixAccess(Member member, boolean evenIfAlreadyPublic)
boolean isPublic = Modifier.isPublic(member.getModifiers())
&& Modifier.isPublic(declaringClass.getModifiers());
if (!isJDKClass(declaringClass) && (!isPublic || evenIfAlreadyPublic)) {
ao.setAccessible(true);
ao.trySetAccessible();
}
} catch (SecurityException ignore) {
} catch (RuntimeException e) {
Expand Down Expand Up @@ -1238,7 +1238,7 @@ private static Field locateField(Class<?> fromClass, String expectedName, Class<
if (!expectedName.equals(f.getName()) || f.getType() != type) {
continue;
}
f.setAccessible(true);
f.trySetAccessible();
return f;
}
// If not found, indicate with exception
Expand Down
Loading