Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2019-03-08 05:32:00 +0000
committerSarika Sinha2019-03-11 04:12:49 +0000
commit065cfd22609e6ce5323d5bf3396a709a74ce1003 (patch)
treeb0dc9eb23156e4ece540683d7f5100ea25fb55d0
parent9f9edbf4463ce6e93615d79dc51542b6adecb47a (diff)
downloadeclipse.jdt.core-065cfd22609e6ce5323d5bf3396a709a74ce1003.tar.gz
eclipse.jdt.core-065cfd22609e6ce5323d5bf3396a709a74ce1003.tar.xz
eclipse.jdt.core-065cfd22609e6ce5323d5bf3396a709a74ce1003.zip
Bug 542558 - [12][dom ast] DOM AST Support for Switch Expressions
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java3
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java14
2 files changed, 10 insertions, 7 deletions
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
index 6004f8005a..0cd3fd6b1f 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
@@ -2593,7 +2593,8 @@ public final class AST {
/**
* Creates a new unparented switch case statement node owned by
- * this AST. By default, the expression is unspecified, but legal.
+ * this AST. By default, the node has no expression, but legal, and
+ * switchLabeledRule is false which indicates ":".
*
* @return a new unparented switch case node
*/
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 6e430a15a7..3e78544f30 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
@@ -115,7 +115,7 @@ public class SwitchCase extends Statement {
/**
- * The expression; <code>empty</code> for none;
+ * The expression list; <code>empty</code> for none;
*/
private ASTNode.NodeList expressions = null;
@@ -126,7 +126,8 @@ public class SwitchCase extends Statement {
/**
* Creates a new AST node for a switch case pseudo-statement owned by the
- * given AST. By default, there is an unspecified, but legal, expression.
+ * given AST. By default, there is no expression, but legal, and switchLabeledRule
+ * is false which indicates ":".
*
* @param ast the AST that is to own this node
*/
@@ -210,7 +211,7 @@ public class SwitchCase extends Statement {
* <code>null</code> if there is none (the "default:" case).
*
* @return the expression node, or <code>null</code> if there is none
- * @deprecated use getExpressions() (see JLS 12)
+ * @deprecated use expressions() (see JLS 12)
*/
public Expression getExpression() {
if (!this.expressionInitialized) {
@@ -231,7 +232,8 @@ public class SwitchCase extends Statement {
* Returns the list of expressions of this switch case, or
* <code>empty</code> if there is none (the "default:" case).
*
- * @return the expression node, or <code>expression</code> if there is none
+ * @return the list of expression nodes
+ * (element type: {@link Expression})
* @exception UnsupportedOperationException if this operation is used below JLS12
* @since 3.17 BETA_JAVA_12
*/
@@ -281,7 +283,7 @@ public class SwitchCase extends Statement {
* Gets the switchLabeledRule of this switch case as <code>true</code> or <code>false</code>.
*<code>true</code> indicates "->" and <code>false</code> indicates ":".
*
- * @return switchLabeledRule <code>true</code> or </false>
+ * @return switchLabeledRule <code>true</code> or <code>false</code>
* @exception UnsupportedOperationException if this operation is used below JLS12
* @since 3.17 BETA_JAVA_12
*/
@@ -294,7 +296,7 @@ public class SwitchCase extends Statement {
* Returns whether this switch case represents the "default:" case.
* <p>
* This convenience method is equivalent to
- * <code>getExpression() == null</code> or <code>getExpressions().isEmpty()</code>.
+ * <code>getExpression() == null</code> or <code>expressions().isEmpty()</code>.
* </p>
*
* @return <code>true</code> if this is the default switch case, and

Back to the top