53 * @return the expression for the case, or null |
53 * @return the expression for the case, or null |
54 */ |
54 */ |
55 ExpressionTree getExpression(); |
55 ExpressionTree getExpression(); |
56 |
56 |
57 /** |
57 /** |
|
58 * {@preview Associated with switch expressions, a preview feature of |
|
59 * the Java language. |
|
60 * |
|
61 * This method is associated with <i>switch expressions</i>, a preview |
|
62 * feature of the Java language. Preview features |
|
63 * may be removed in a future release, or upgraded to permanent |
|
64 * features of the Java language.} |
|
65 * |
58 * Returns the labels for this case. |
66 * Returns the labels for this case. |
59 * For default case, returns an empty list. |
67 * For default case, returns an empty list. |
60 * |
68 * |
61 * @return labels for this case |
69 * @return labels for this case |
62 * @since 12 |
70 * @since 12 |
63 * |
71 * |
64 * @deprecated This method is modeling a case with multiple labels, |
72 * @preview This method is modeling a case with multiple labels, |
65 * which is part of a preview feature and may be removed |
73 * which is part of a preview feature and may be removed |
66 * if the preview feature is removed. |
74 * if the preview feature is removed. |
67 */ |
75 */ |
68 @Deprecated(forRemoval=true, since="12") |
76 @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS) |
69 List<? extends ExpressionTree> getExpressions(); |
77 List<? extends ExpressionTree> getExpressions(); |
70 |
78 |
71 /** |
79 /** |
72 * For case with kind {@linkplain CaseKind#STATEMENT}, |
80 * For case with kind {@linkplain CaseKind#STATEMENT}, |
73 * returns the statements labeled by the case. |
81 * returns the statements labeled by the case. |
76 * @return the statements labeled by the case or null |
84 * @return the statements labeled by the case or null |
77 */ |
85 */ |
78 List<? extends StatementTree> getStatements(); |
86 List<? extends StatementTree> getStatements(); |
79 |
87 |
80 /** |
88 /** |
|
89 * {@preview Associated with switch expressions, a preview feature of |
|
90 * the Java language. |
|
91 * |
|
92 * This method is associated with <i>switch expressions</i>, a preview |
|
93 * feature of the Java language. Preview features |
|
94 * may be removed in a future release, or upgraded to permanent |
|
95 * features of the Java language.} |
|
96 * |
81 * For case with kind {@linkplain CaseKind#RULE}, |
97 * For case with kind {@linkplain CaseKind#RULE}, |
82 * returns the statement or expression after the arrow. |
98 * returns the statement or expression after the arrow. |
83 * Returns {@code null} for case with kind |
99 * Returns {@code null} for case with kind |
84 * {@linkplain CaseKind#STATEMENT}. |
100 * {@linkplain CaseKind#STATEMENT}. |
85 * |
101 * |
86 * @return case value or null |
102 * @return case value or null |
87 * @since 12 |
103 * @since 12 |
88 * |
|
89 * @deprecated This method is modeling a rule case, |
|
90 * which is part of a preview feature and may be removed |
|
91 * if the preview feature is removed. |
|
92 */ |
104 */ |
93 @Deprecated(forRemoval=true, since="12") |
105 @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS) |
94 public default Tree getBody() { |
106 public default Tree getBody() { |
95 return null; |
107 return null; |
96 } |
108 } |
97 |
109 |
98 /** |
110 /** |
|
111 * {@preview Associated with switch expressions, a preview feature of |
|
112 * the Java language. |
|
113 * |
|
114 * This method is associated with <i>switch expressions</i>, a preview |
|
115 * feature of the Java language. Preview features |
|
116 * may be removed in a future release, or upgraded to permanent |
|
117 * features of the Java language.} |
|
118 * |
99 * Returns the kind of this case. |
119 * Returns the kind of this case. |
100 * |
120 * |
101 * @return the kind of this case |
121 * @return the kind of this case |
102 * @since 12 |
122 * @since 12 |
103 * |
|
104 * @deprecated This method is used to model a rule case, |
|
105 * which is part of a preview feature and may be removed |
|
106 * if the preview feature is removed. |
|
107 */ |
123 */ |
108 @Deprecated(forRemoval=true, since="12") |
124 @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS) |
|
125 @SuppressWarnings("preview") |
109 public default CaseKind getCaseKind() { |
126 public default CaseKind getCaseKind() { |
110 return CaseKind.STATEMENT; |
127 return CaseKind.STATEMENT; |
111 } |
128 } |
112 |
129 |
113 /** |
130 /** |
|
131 * {@preview Associated with switch expressions, a preview feature of |
|
132 * the Java language. |
|
133 * |
|
134 * This enum is associated with <i>switch expressions</i>, a preview |
|
135 * feature of the Java language. Preview features |
|
136 * may be removed in a future release, or upgraded to permanent |
|
137 * features of the Java language.} |
|
138 * |
114 * The syntatic form of this case: |
139 * The syntatic form of this case: |
115 * <ul> |
140 * <ul> |
116 * <li>STATEMENT: {@code case <expression>: <statements>}</li> |
141 * <li>STATEMENT: {@code case <expression>: <statements>}</li> |
117 * <li>RULE: {@code case <expression> -> <expression>/<statement>}</li> |
142 * <li>RULE: {@code case <expression> -> <expression>/<statement>}</li> |
118 * </ul> |
143 * </ul> |
119 * |
144 * |
120 * @since 12 |
145 * @since 12 |
121 * |
|
122 * @deprecated This enum is used to model a rule case, |
|
123 * which is part of a preview feature and may be removed |
|
124 * if the preview feature is removed. |
|
125 */ |
146 */ |
126 @Deprecated(forRemoval=true, since="12") |
147 @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS) |
|
148 @SuppressWarnings("preview") |
127 public enum CaseKind { |
149 public enum CaseKind { |
128 /** |
150 /** |
129 * Case is in the form: {@code case <expression>: <statements>}. |
151 * Case is in the form: {@code case <expression>: <statements>}. |
130 */ |
152 */ |
131 STATEMENT, |
153 STATEMENT, |