aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok/core
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-10-29 23:13:52 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-10-29 23:13:59 +0100
commiteca219ee6433cd964f0549a114a791ca4eb9f0fa (patch)
tree20f6fed449504fbf5dbc52bd15ff3f2458dd90f8 /src/utils/lombok/core
parent182cb0cb9e8db6341fb4633c3849b5e90ba6d088 (diff)
downloadlombok-eca219ee6433cd964f0549a114a791ca4eb9f0fa.tar.gz
lombok-eca219ee6433cd964f0549a114a791ca4eb9f0fa.tar.bz2
lombok-eca219ee6433cd964f0549a114a791ca4eb9f0fa.zip
eliminate ‘you are using private API’ warnings by streamlining all reflective access via a class that uses sun.misc.Unsafe to arrange access. From the nqzero permit-reflect library.
Diffstat (limited to 'src/utils/lombok/core')
-rw-r--r--src/utils/lombok/core/FieldAugment.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/utils/lombok/core/FieldAugment.java b/src/utils/lombok/core/FieldAugment.java
index ee8acf4d..4a32ad04 100644
--- a/src/utils/lombok/core/FieldAugment.java
+++ b/src/utils/lombok/core/FieldAugment.java
@@ -27,6 +27,8 @@ import java.lang.reflect.Modifier;
import java.util.Map;
import java.util.WeakHashMap;
+import lombok.permit.Permit;
+
public abstract class FieldAugment<T, F> {
private static Object getDefaultValue(Class<?> type) {
if (type == boolean.class) return false;
@@ -101,10 +103,9 @@ public abstract class FieldAugment<T, F> {
private static Field findField(Class<?> type, Class<?> wantedType, String name) {
try {
- Field f = type.getDeclaredField(name);
+ Field f = Permit.getField(type, name);
if (Modifier.isStatic(f.getModifiers()) || Modifier.isFinal(f.getModifiers())) return null;
if (!typeIsAssignmentCompatible(f.getType(), wantedType)) return null;
- f.setAccessible(true);
return f;
} catch (Exception e) {
return null;