diff options
author | Stephan Herrmann | 2018-11-14 13:58:04 +0000 |
---|---|---|
committer | Jay Arthanareeswaran | 2018-11-15 05:42:11 +0000 |
commit | dd3a278b906114fedcdb46af8aca43eac75b3bfe (patch) | |
tree | 2bf9f91b7019177a6cadc887a3ca6637c55f042f /org.eclipse.jdt.core/compiler/org | |
parent | 299476ded83d2b23da044bfa8a9a82012881d3c2 (diff) | |
download | eclipse.jdt.core-dd3a278b906114fedcdb46af8aca43eac75b3bfe.tar.gz eclipse.jdt.core-dd3a278b906114fedcdb46af8aca43eac75b3bfe.tar.xz eclipse.jdt.core-dd3a278b906114fedcdb46af8aca43eac75b3bfe.zip |
Bug 539570 - Eclipse 2018-09 won't compile Java 11 source; thinks it isI20181115-1800I20181115-0200
below 1.7
Change-Id: Ib7c4bfb5241e478681724f75677cd1e3bda4dea1
Signed-off-by: Stephan Herrmann <stephan.herrmann@berlin.de>
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org')
2 files changed, 4 insertions, 8 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java index 70d4378a61..bfcdf5e888 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java @@ -169,10 +169,9 @@ public interface ClassFileConstants { case ClassFileConstants.MAJOR_VERSION_1_1: return ((long)ClassFileConstants.MAJOR_VERSION_1_1 << 16) + ClassFileConstants.MINOR_VERSION_3; default: - if (major <= MAJOR_LATEST_VERSION) - return ((long)major << 16) + ClassFileConstants.MINOR_VERSION_0; + major = Math.min(major, MAJOR_LATEST_VERSION); + return ((long)major << 16) + ClassFileConstants.MINOR_VERSION_0; } - return 0; } /* * cldc1.1 is 45.3, but we modify it to be different from JDK1_1. diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java index b09fa0512b..8b3ef33a3e 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java @@ -860,11 +860,8 @@ public class CompilerOptions { if (index != -1) version = version.substring(0, index); } - int major = Integer.parseInt(version) + ClassFileConstants.MAJOR_VERSION_0; - if (major <= ClassFileConstants.MAJOR_LATEST_VERSION) { - long jdkLevel = ((long) major << 16) + ClassFileConstants.MINOR_VERSION_0; - return jdkLevel; - } + int major = Math.min(Integer.parseInt(version) + ClassFileConstants.MAJOR_VERSION_0, ClassFileConstants.MAJOR_LATEST_VERSION); + return ((long) major << 16) + ClassFileConstants.MINOR_VERSION_0; } catch (NumberFormatException e) { // do nothing and return 0 at the end } |