14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.lang.model.util; 27 28 import javax.lang.model.element.*; 29 import javax.annotation.processing.SupportedSourceVersion; 30 import static javax.lang.model.SourceVersion.*; 31 import javax.lang.model.SourceVersion; 32 33 /** 34 * A visitor of program elements based on their {@linkplain 35 * ElementKind kind} with default behavior appropriate for the {@link 36 * SourceVersion#RELEASE_14 RELEASE_14} source version. 37 * 38 * For {@linkplain 39 * Element elements} <code><i>Xyz</i></code> that may have more than one 40 * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate 41 * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the 42 * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods 43 * call {@link #defaultAction defaultAction}, passing their arguments 44 * to {@code defaultAction}'s corresponding parameters. 45 * 46 * <p> Methods in this class may be overridden subject to their 47 * general contract. Note that annotating methods in concrete 48 * subclasses with {@link java.lang.Override @Override} will help 49 * ensure that methods are overridden as intended. 50 * 51 * <p> <b>WARNING:</b> The {@code ElementVisitor} interface 52 * implemented by this class may have methods added to it or the 53 * {@code ElementKind} {@code enum} used in this case may have 61 * 62 * <p>When such a new visit method is added, the default 63 * implementation in this class will be to call the {@link 64 * #visitUnknown visitUnknown} method. A new abstract element kind 65 * visitor class will also be introduced to correspond to the new 66 * language level; this visitor will have different default behavior 67 * for the visit method in question. When the new visitor is 68 * introduced, all or portions of this visitor may be deprecated. 69 * 70 * @param <R> the return type of this visitor's methods. Use {@link 71 * Void} for visitors that do not need to return results. 72 * @param <P> the type of the additional parameter to this visitor's 73 * methods. Use {@code Void} for visitors that do not need an 74 * additional parameter. 75 * 76 * @see ElementKindVisitor6 77 * @see ElementKindVisitor7 78 * @see ElementKindVisitor8 79 * @see ElementKindVisitor9 80 * @since 14 81 * @deprecated This class is part of a preview feature and may be removed 82 * if the preview feature is removed. 83 */ 84 @Deprecated(forRemoval=true, since="14") 85 @SuppressWarnings("removal") 86 @SupportedSourceVersion(RELEASE_14) 87 public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> { 88 /** 89 * Constructor for concrete subclasses; uses {@code null} for the 90 * default value. 91 */ 92 protected ElementKindVisitor14() { 93 super(null); 94 } 95 96 /** 97 * Constructor for concrete subclasses; uses the argument for the 98 * default value. 99 * 100 * @param defaultValue the value to assign to {@link #DEFAULT_VALUE} 101 */ 102 protected ElementKindVisitor14(R defaultValue) { 103 super(defaultValue); 104 } 105 | 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.lang.model.util; 27 28 import javax.lang.model.element.*; 29 import javax.annotation.processing.SupportedSourceVersion; 30 import static javax.lang.model.SourceVersion.*; 31 import javax.lang.model.SourceVersion; 32 33 /** 34 * {@preview Associated with records, a preview feature of the Java language. 35 * 36 * This class is associated with <i>records</i>, a preview 37 * feature of the Java language. Programs can only use this 38 * method when preview features are enabled. Preview features 39 * may be removed in a future release, or upgraded to permanent 40 * features of the Java language.} 41 * 42 * A visitor of program elements based on their {@linkplain 43 * ElementKind kind} with default behavior appropriate for the {@link 44 * SourceVersion#RELEASE_14 RELEASE_14} source version. 45 * 46 * For {@linkplain 47 * Element elements} <code><i>Xyz</i></code> that may have more than one 48 * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate 49 * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the 50 * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods 51 * call {@link #defaultAction defaultAction}, passing their arguments 52 * to {@code defaultAction}'s corresponding parameters. 53 * 54 * <p> Methods in this class may be overridden subject to their 55 * general contract. Note that annotating methods in concrete 56 * subclasses with {@link java.lang.Override @Override} will help 57 * ensure that methods are overridden as intended. 58 * 59 * <p> <b>WARNING:</b> The {@code ElementVisitor} interface 60 * implemented by this class may have methods added to it or the 61 * {@code ElementKind} {@code enum} used in this case may have 69 * 70 * <p>When such a new visit method is added, the default 71 * implementation in this class will be to call the {@link 72 * #visitUnknown visitUnknown} method. A new abstract element kind 73 * visitor class will also be introduced to correspond to the new 74 * language level; this visitor will have different default behavior 75 * for the visit method in question. When the new visitor is 76 * introduced, all or portions of this visitor may be deprecated. 77 * 78 * @param <R> the return type of this visitor's methods. Use {@link 79 * Void} for visitors that do not need to return results. 80 * @param <P> the type of the additional parameter to this visitor's 81 * methods. Use {@code Void} for visitors that do not need an 82 * additional parameter. 83 * 84 * @see ElementKindVisitor6 85 * @see ElementKindVisitor7 86 * @see ElementKindVisitor8 87 * @see ElementKindVisitor9 88 * @since 14 89 */ 90 @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, 91 essentialAPI=false) 92 @SuppressWarnings("preview") 93 @SupportedSourceVersion(RELEASE_14) 94 public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> { 95 /** 96 * Constructor for concrete subclasses; uses {@code null} for the 97 * default value. 98 */ 99 protected ElementKindVisitor14() { 100 super(null); 101 } 102 103 /** 104 * Constructor for concrete subclasses; uses the argument for the 105 * default value. 106 * 107 * @param defaultValue the value to assign to {@link #DEFAULT_VALUE} 108 */ 109 protected ElementKindVisitor14(R defaultValue) { 110 super(defaultValue); 111 } 112 |