diff options
author | Robbert Jan Grootjans <grootjans@gmail.com> | 2013-03-08 16:52:14 +0100 |
---|---|---|
committer | Robbert Jan Grootjans <grootjans@gmail.com> | 2013-03-08 16:52:14 +0100 |
commit | 12771880260d57209afcda15fd2b00f3181c38a6 (patch) | |
tree | 059654e3ecd3d98fb06e6b229a99e2095e067ede /src/utils | |
parent | 8bb1542acb4e0c3a10396babe265b16a5e9d0dfd (diff) | |
download | lombok-12771880260d57209afcda15fd2b00f3181c38a6.tar.gz lombok-12771880260d57209afcda15fd2b00f3181c38a6.tar.bz2 lombok-12771880260d57209afcda15fd2b00f3181c38a6.zip |
Added switch to CommentsCatcher. Assumption, until proven otherwise is
that JDK8 behaves similar to JDK7.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/lombok/javac/CommentCatcher.java | 9 |
1 files changed, 7 insertions, 2 deletions
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); |