From 9ecfe2302f3cd1d654196e072cce0b334f21ffd9 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Wed, 7 Feb 2018 00:19:10 +0100 Subject: Fix version parsing for jdk10. --- src/utils/lombok/javac/Javac.java | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/utils/lombok') diff --git a/src/utils/lombok/javac/Javac.java b/src/utils/lombok/javac/Javac.java index 6f99463b..2adc5265 100644 --- a/src/utils/lombok/javac/Javac.java +++ b/src/utils/lombok/javac/Javac.java @@ -63,8 +63,8 @@ public class Javac { /** Matches any of the 8 primitive names, such as {@code boolean}. */ private static final Pattern PRIMITIVE_TYPE_NAME_PATTERN = Pattern.compile("^(boolean|byte|short|int|long|float|double|char)$"); - private static final Pattern VERSION_PARSER = Pattern.compile("^(\\d{1,6})\\.(\\d{1,6}).*$"); - private static final Pattern SOURCE_PARSER = Pattern.compile("^JDK(\\d{1,6})_(\\d{1,6}).*$"); + private static final Pattern VERSION_PARSER = Pattern.compile("^(\\d{1,6})\\.?(\\d{1,6})?.*$"); + private static final Pattern SOURCE_PARSER = Pattern.compile("^JDK(\\d{1,6})_?(\\d{1,6})?.*$"); private static final AtomicInteger compilerVersion = new AtomicInteger(-1); @@ -79,11 +79,11 @@ public class Javac { Matcher m = VERSION_PARSER.matcher(JavaCompiler.version()); if (m.matches()) { int major = Integer.parseInt(m.group(1)); - int minor = Integer.parseInt(m.group(2)); if (major == 1) { - compilerVersion.set(minor); - return minor; + int minor = Integer.parseInt(m.group(2)); + return setVersion(minor); } + if (major >= 9) return setVersion(major); } } @@ -92,16 +92,19 @@ public class Javac { Matcher m = SOURCE_PARSER.matcher(name); if (m.matches()) { int major = Integer.parseInt(m.group(1)); - int minor = Integer.parseInt(m.group(2)); if (major == 1) { - compilerVersion.set(minor); - return minor; + int minor = Integer.parseInt(m.group(2)); + return setVersion(minor); } + if (major >= 9) return setVersion(major); } } - - compilerVersion.set(6); - return 6; + return setVersion(6); + } + + private static int setVersion(int version) { + compilerVersion.set(version); + return version; } private static final Class DOCCOMMENTTABLE_CLASS; -- cgit From 42961e8921cd98f688252eedc68cbe0baa0496ea Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 7 Feb 2018 00:49:08 +0100 Subject: [trivial] copyright header year bump to 2018 --- build.xml | 2 +- src/core/lombok/bytecode/ClassFileMetaData.java | 2 +- src/core/lombok/core/AnnotationProcessor.java | 2 +- src/core/lombok/core/LombokInternalAliasing.java | 2 +- src/core/lombok/core/handlers/HandlerUtil.java | 2 +- .../lombok/eclipse/handlers/EclipseHandlerUtil.java | 2 +- src/core/lombok/eclipse/handlers/HandleBuilder.java | 2 +- .../eclipse/handlers/HandleBuilderDefault.java | 21 +++++++++++++++++++++ .../javac/apt/InterceptingJavaFileManager.java | 2 +- .../lombok/javac/handlers/HandleBuilderDefault.java | 21 +++++++++++++++++++++ .../lombok/javac/handlers/JavacHandlerUtil.java | 2 +- src/core9/module-info.java | 21 +++++++++++++++++++++ .../lombok/delombok/DocCommentIntegrator.java | 2 +- src/eclipseAgent/lombok/eclipse/agent/PatchVal.java | 2 +- .../lombok/eclipse/agent/PatchValEclipse.java | 2 +- src/launch/lombok/launch/AnnotationProcessor.java | 2 +- src/utils/lombok/javac/Javac.java | 2 +- 17 files changed, 77 insertions(+), 14 deletions(-) (limited to 'src/utils/lombok') diff --git a/build.xml b/build.xml index 914b658b..3a8d6c14 100644 --- a/build.xml +++ b/build.xml @@ -1,5 +1,5 @@