diff options
author | Jay Arthanareeswaran | 2020-08-10 08:24:33 +0000 |
---|---|---|
committer | Jay Arthanareeswaran | 2020-08-10 13:33:38 +0000 |
commit | 3b92629ad51a4bba5b31518b221948cf7ca719e8 (patch) | |
tree | d8d2f833987287b195b23fd638e86ea2577ec0d0 | |
parent | c84069756aabdd1d1eb11ff5899aa564192cc5b7 (diff) | |
download | eclipse.jdt.core-3b92629ad51a4bba5b31518b221948cf7ca719e8.tar.gz eclipse.jdt.core-3b92629ad51a4bba5b31518b221948cf7ca719e8.tar.xz eclipse.jdt.core-3b92629ad51a4bba5b31518b221948cf7ca719e8.zip |
handling
Add utility method JavaFeature#isSupported()
Change-Id: Ic0d09805f0f11d83122e5d6e7481064170b28f69
Signed-off-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
-rw-r--r-- | org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java index b2dd075eb2..f9a9e109f2 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java @@ -75,6 +75,11 @@ public enum JavaFeature { public char[][] getRestrictedKeywords() { return this.restrictedKeywords; } + public boolean isSupported(CompilerOptions options) { + if (this.isPreview) + return options.enablePreviewFeatures; + return this.getCompliance() <= options.sourceLevel; + } JavaFeature(long compliance, String name, char[][] restrictedKeywords, boolean isPreview) { this.compliance = compliance; |