From 12771880260d57209afcda15fd2b00f3181c38a6 Mon Sep 17 00:00:00 2001 From: Robbert Jan Grootjans Date: Fri, 8 Mar 2013 16:52:14 +0100 Subject: Added switch to CommentsCatcher. Assumption, until proven otherwise is that JDK8 behaves similar to JDK7. --- src/utils/lombok/javac/CommentCatcher.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/utils') diff --git a/src/utils/lombok/javac/CommentCatcher.java b/src/utils/lombok/javac/CommentCatcher.java index 474dc43d..e3754627 100644 --- a/src/utils/lombok/javac/CommentCatcher.java +++ b/src/utils/lombok/javac/CommentCatcher.java @@ -64,8 +64,10 @@ public class CommentCatcher { try { if (JavaCompiler.version().startsWith("1.6")) { Class.forName("lombok.javac.java6.CommentCollectingScannerFactory").getMethod("preRegister", Context.class).invoke(null, context); - } else { + } else if (JavaCompiler.version().startsWith("1.7") || JavaCompiler.version().startsWith("1.8")) { Class.forName("lombok.javac.java7.CommentCollectingScannerFactory").getMethod("preRegister", Context.class).invoke(null, context); + } else { + throw new IllegalStateException("No comments parser for compiler version " + JavaCompiler.version()); } } catch (Exception e) { if (e instanceof RuntimeException) throw (RuntimeException)e; @@ -79,10 +81,13 @@ public class CommentCatcher { if (JavaCompiler.version().startsWith("1.6")) { Class parserFactory = Class.forName("lombok.javac.java6.CommentCollectingParserFactory"); parserFactory.getMethod("setInCompiler",JavaCompiler.class, Context.class, Map.class).invoke(null, compiler, context, commentsMap); - } else { + } else if (JavaCompiler.version().startsWith("1.7") || JavaCompiler.version().startsWith("1.8")) { Class parserFactory = Class.forName("lombok.javac.java7.CommentCollectingParserFactory"); parserFactory.getMethod("setInCompiler",JavaCompiler.class, Context.class, Map.class).invoke(null, compiler, context, commentsMap); + } else { + throw new IllegalStateException("No comments parser for compiler version " + JavaCompiler.version()); } + } catch (Exception e) { if (e instanceof RuntimeException) throw (RuntimeException)e; throw new RuntimeException(e); -- cgit