author | jlahoda |
Wed, 02 Oct 2019 10:59:40 +0200 | |
branch | JDK-8226585-branch |
changeset 58440 | 4c8a6d1d066c |
parent 58109 | ee07de0d2c16 |
permissions | -rw-r--r-- |
51563
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
1 |
/* |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
4 |
* |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
10 |
* |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
15 |
* accompanied this code). |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
16 |
* |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
20 |
* |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
23 |
* questions. |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
24 |
*/ |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
25 |
|
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
26 |
package com.sun.source.tree; |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
27 |
|
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
28 |
import java.util.List; |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
29 |
|
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
30 |
/** |
58440
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
31 |
* {@preview Associated with switch expressions, a preview feature of |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
32 |
* the Java language. |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
33 |
* |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
34 |
* This interface is associated with <i>switch expressions</i>, a preview |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
35 |
* feature of the Java language. Preview features |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
36 |
* may be removed in a future release, or upgraded to permanent |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
37 |
* features of the Java language.} |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
38 |
* |
51563
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
39 |
* A tree node for a {@code switch} expression. |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
40 |
* |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
41 |
* For example: |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
42 |
* <pre> |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
43 |
* switch ( <em>expression</em> ) { |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
44 |
* <em>cases</em> |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
45 |
* } |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
46 |
* </pre> |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
47 |
* |
54817 | 48 |
* @jls 15.29 Switch Expressions |
51563
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
49 |
* |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
50 |
* @since 12 |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
51 |
*/ |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
54817
diff
changeset
|
52 |
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS) |
51563
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
53 |
public interface SwitchExpressionTree extends ExpressionTree { |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
54 |
/** |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
55 |
* Returns the expression for the {@code switch} expression. |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
56 |
* @return the expression |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
57 |
*/ |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
58 |
ExpressionTree getExpression(); |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
59 |
|
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
60 |
/** |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
61 |
* Returns the cases for the {@code switch} expression. |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
62 |
* @return the cases |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
63 |
*/ |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
64 |
List<? extends CaseTree> getCases(); |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
diff
changeset
|
65 |
} |