diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-10-29 23:13:52 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-10-29 23:13:59 +0100 |
commit | eca219ee6433cd964f0549a114a791ca4eb9f0fa (patch) | |
tree | 20f6fed449504fbf5dbc52bd15ff3f2458dd90f8 /src/utils/lombok/javac/java8/CommentCollectingParserFactory.java | |
parent | 182cb0cb9e8db6341fb4633c3849b5e90ba6d088 (diff) | |
download | lombok-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/javac/java8/CommentCollectingParserFactory.java')
-rw-r--r-- | src/utils/lombok/javac/java8/CommentCollectingParserFactory.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/utils/lombok/javac/java8/CommentCollectingParserFactory.java b/src/utils/lombok/javac/java8/CommentCollectingParserFactory.java index 2fdaddfe..0988ce6d 100644 --- a/src/utils/lombok/javac/java8/CommentCollectingParserFactory.java +++ b/src/utils/lombok/javac/java8/CommentCollectingParserFactory.java @@ -30,6 +30,8 @@ import com.sun.tools.javac.parser.ParserFactory; import com.sun.tools.javac.parser.ScannerFactory; import com.sun.tools.javac.util.Context; +import lombok.permit.Permit; + public class CommentCollectingParserFactory extends ParserFactory { private final Context context; @@ -66,8 +68,7 @@ public class CommentCollectingParserFactory extends ParserFactory { context.put(CommentCollectingParserFactory.key(), (ParserFactory) null); Field field; try { - field = JavaCompiler.class.getDeclaredField("parserFactory"); - field.setAccessible(true); + field = Permit.getField(JavaCompiler.class, "parserFactory"); field.set(compiler, new CommentCollectingParserFactory(context)); } catch (Exception e) { throw new IllegalStateException("Could not set comment sensitive parser in the compiler", e); |