From ab8e14736f8c3a7cb96ae7351d4bb1818131f2b2 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 4 Dec 2017 23:45:57 +0100 Subject: [JDK9] fixing delombok’s comment integration in JDK9. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lombok/javac/java8/CommentCollectingParserFactory.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/utils/lombok/javac/java8') diff --git a/src/utils/lombok/javac/java8/CommentCollectingParserFactory.java b/src/utils/lombok/javac/java8/CommentCollectingParserFactory.java index 45f865ad..2fdaddfe 100644 --- a/src/utils/lombok/javac/java8/CommentCollectingParserFactory.java +++ b/src/utils/lombok/javac/java8/CommentCollectingParserFactory.java @@ -52,6 +52,16 @@ public class CommentCollectingParserFactory extends ParserFactory { //Either way this will work out. } + public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap, boolean parseModuleInfo) { + ScannerFactory scannerFactory = ScannerFactory.instance(context); + Lexer lexer = scannerFactory.newScanner(input, true); + Object x = new CommentCollectingParser(this, lexer, true, keepLineMap, keepEndPos); + return (JavacParser) x; + // CCP is based on a stub which extends nothing, but at runtime the stub is replaced with either + //javac6's EndPosParser which extends Parser, or javac8's JavacParser which implements Parser. + //Either way this will work out. + } + public static void setInCompiler(JavaCompiler compiler, Context context) { context.put(CommentCollectingParserFactory.key(), (ParserFactory) null); Field field; -- cgit