Skip to content

Commit

Permalink
LPS-84318 Remove redundant Method.isAccessible and Field.isAccessible…
Browse files Browse the repository at this point in the history
… checks
  • Loading branch information
Leon Chi authored and shuyangzhou committed Aug 17, 2018
1 parent c4659a1 commit 39493b3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
Expand Up @@ -24,9 +24,7 @@ public class ReflectionUtil {
public static Field getField(Class<?> clazz, String name) throws Exception {
Field field = clazz.getDeclaredField(name);

if (!field.isAccessible()) {
field.setAccessible(true);
}
field.setAccessible(true);

return field;
}
Expand Down
Expand Up @@ -144,9 +144,7 @@ public Object marshall(
continue;
}

if (!field.isAccessible()) {
field.setAccessible(true);
}
field.setAccessible(true);

if (fieldName.startsWith("_")) {
fieldName = fieldName.substring(1);
Expand Down Expand Up @@ -378,9 +376,7 @@ public Object unmarshall(
continue;
}

if (!field.isAccessible()) {
field.setAccessible(true);
}
field.setAccessible(true);

if (fieldName.startsWith("_")) {
fieldName = fieldName.substring(1);
Expand Down
Expand Up @@ -56,9 +56,7 @@ public ServiceBeanMethodInvocation(
_method = method;
_arguments = arguments;

if (!_method.isAccessible()) {
_method.setAccessible(true);
}
_method.setAccessible(true);

if (_method.getDeclaringClass() == Object.class) {
String methodName = _method.getName();
Expand Down
Expand Up @@ -43,9 +43,7 @@ protected static Method get(MethodKey methodKey)
method = declaringClass.getDeclaredMethod(
methodKey.getMethodName(), methodKey.getParameterTypes());

if (!method.isAccessible()) {
method.setAccessible(true);
}
method.setAccessible(true);

_methods.put(methodKey, method);
}
Expand Down
Expand Up @@ -31,9 +31,7 @@ public ReferenceEntry(Object object, Field field) {
_object = object;
_field = field;

if (!_field.isAccessible()) {
_field.setAccessible(true);
}
_field.setAccessible(true);
}

public Field getField() {
Expand Down

0 comments on commit 39493b3

Please sign in to comment.