diff options
author | Manoj Palat | 2019-03-15 13:08:21 +0000 |
---|---|---|
committer | Manoj Palat | 2019-03-15 13:47:47 +0000 |
commit | d21549b5b3197f76572d4374c2560bac0290abc8 (patch) | |
tree | 798cf4b349ba0d2aea207affd79916b14ac636ef | |
parent | 54483a39ec97c4effd2f407ef6cdd4bcec099ade (diff) | |
download | eclipse.jdt.core-d21549b5b3197f76572d4374c2560bac0290abc8.tar.gz eclipse.jdt.core-d21549b5b3197f76572d4374c2560bac0290abc8.tar.xz eclipse.jdt.core-d21549b5b3197f76572d4374c2560bac0290abc8.zip |
Increment commit Bug 542558 comment 69 - [12][dom ast] DOM AST Support
for Switch Expressions
Change-Id: I84286ce7945b83088d6d1156ac743557d74e31ca
-rw-r--r-- | org.eclipse.jdt.core/.settings/.api_filters | 6 | ||||
-rw-r--r-- | org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java | 23 |
2 files changed, 29 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters index 605b445376..1c0081b8a6 100644 --- a/org.eclipse.jdt.core/.settings/.api_filters +++ b/org.eclipse.jdt.core/.settings/.api_filters @@ -46,6 +46,12 @@ <message_argument value="EXPRESSIONS2_PROPERTY"/> </message_arguments> </filter> + <filter comment="For Java 12 Support - case ->" id="336658481"> + <message_arguments> + <message_argument value="org.eclipse.jdt.core.dom.SwitchCase"/> + <message_argument value="SWITCH_LABELED_RULE_PROPERTY"/> + </message_arguments> + </filter> </resource> <resource path="model/org/eclipse/jdt/core/util/IClassFileReader.java" type="org.eclipse.jdt.core.util.IClassFileReader"> <filter comment="default method added for getting nest members" id="404000815"> diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java index c899252a71..1b19ec464e 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java @@ -57,6 +57,12 @@ public class SwitchCase extends Statement { public static final ChildListPropertyDescriptor EXPRESSIONS2_PROPERTY = new ChildListPropertyDescriptor(SwitchCase.class, "expression", Expression.class, CYCLE_RISK); //$NON-NLS-1$); + /** + * The "switchLabeledRule" structural property of this node type (type: {@link Boolean}). + * @since 3.17 BETA_JAVA_12 + */ + public static final SimplePropertyDescriptor SWITCH_LABELED_RULE_PROPERTY = + new SimplePropertyDescriptor(SwitchCase.class, "switchLabeledRule", boolean.class, MANDATORY); //$NON-NLS-1$ /** * A list of property descriptors (element type: @@ -81,6 +87,7 @@ public class SwitchCase extends Statement { propertyList = new ArrayList(2); createPropertyList(SwitchCase.class, propertyList); addProperty(EXPRESSIONS2_PROPERTY , propertyList); + addProperty(SWITCH_LABELED_RULE_PROPERTY, propertyList); PROPERTY_DESCRIPTORS_12 = reapPropertyList(propertyList); } @@ -144,6 +151,20 @@ public class SwitchCase extends Statement { } @Override + final boolean internalGetSetBooleanProperty(SimplePropertyDescriptor property, boolean get, boolean value) { + if (property == SWITCH_LABELED_RULE_PROPERTY) { + if (get) { + return isSwitchLabeledRule(); + } else { + setSwitchLabeledRule(value); + return false; + } + } + // allow default implementation to flag the error + return super.internalGetSetBooleanProperty(property, get, value); + } + + @Override final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { if (property == EXPRESSION_PROPERTY) { if (get) { @@ -276,7 +297,9 @@ public class SwitchCase extends Statement { */ public void setSwitchLabeledRule(boolean switchLabeledRule) { unsupportedBelow12(); + preValueChange(SWITCH_LABELED_RULE_PROPERTY); this.switchLabeledRule = switchLabeledRule; + postValueChange(SWITCH_LABELED_RULE_PROPERTY); } /** |