From eca219ee6433cd964f0549a114a791ca4eb9f0fa Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 29 Oct 2018 23:13:52 +0100 Subject: 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. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/lombok/core/FieldAugment.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/utils/lombok/core') 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 { private static Object getDefaultValue(Class type) { if (type == boolean.class) return false; @@ -101,10 +103,9 @@ public abstract class FieldAugment { 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; -- cgit