Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Arthanareeswaran2020-08-10 08:24:33 +0000
committerJay Arthanareeswaran2020-08-10 13:33:38 +0000
commit3b92629ad51a4bba5b31518b221948cf7ca719e8 (patch)
treed8d2f833987287b195b23fd638e86ea2577ec0d0
parentc84069756aabdd1d1eb11ff5899aa564192cc5b7 (diff)
downloadeclipse.jdt.core-3b92629ad51a4bba5b31518b221948cf7ca719e8.tar.gz
eclipse.jdt.core-3b92629ad51a4bba5b31518b221948cf7ca719e8.tar.xz
eclipse.jdt.core-3b92629ad51a4bba5b31518b221948cf7ca719e8.zip
Bug 565438 - [15] Consolidate all language feature support errorY20200811-1200Y20200810-1200
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.java5
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;

Back to the top