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/javac/java6/CommentCollectingParserFactory.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/utils/lombok/javac/java6') diff --git a/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java b/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java index 0cf8fdcd..5d96f9d1 100644 --- a/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java +++ b/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java @@ -28,6 +28,8 @@ import com.sun.tools.javac.parser.Lexer; import com.sun.tools.javac.parser.Parser; import com.sun.tools.javac.util.Context; +import lombok.permit.Permit; + public class CommentCollectingParserFactory extends Parser.Factory { static Context.Key key() { return parserFactoryKey; @@ -49,8 +51,7 @@ public class CommentCollectingParserFactory extends Parser.Factory { context.put(CommentCollectingParserFactory.key(), (Parser.Factory)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); -- cgit