OpenJDK / amber / amber
changeset 57887:cf64ea74503e records-and-sealed
make javax.lang.model.element.RecordComponentElement a top level element
line wrap: on
line diff
--- a/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java Mon Oct 07 12:55:23 2019 -0400 @@ -78,8 +78,8 @@ * The annotation may appear directly or be inherited. Only * package elements, module elements, and type elements <i>included</i> in this * round of annotation processing, or declarations of members, - * constructors, parameters, or type parameters declared within - * those, are returned. Included type elements are {@linkplain + * constructors, parameters, type parameters, or record components + * declared within those, are returned. Included type elements are {@linkplain * #getRootElements root types} and any member types nested within * them. Elements of a package are not considered included simply * because a {@code package-info} file for that package was @@ -133,8 +133,8 @@ * The annotation may appear directly or be inherited. Only * package elements, module elements, and type elements <i>included</i> in this * round of annotation processing, or declarations of members, - * constructors, parameters, or type parameters declared within - * those, are returned. Included type elements are {@linkplain + * constructors, parameters, type parameters, or record components + * declared within those, are returned. Included type elements are {@linkplain * #getRootElements root types} and any member types nested within * them. Elements in a package are not considered included simply * because a {@code package-info} file for that package was
--- a/src/java.compiler/share/classes/javax/lang/model/element/Element.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/element/Element.java Mon Oct 07 12:55:23 2019 -0400 @@ -118,6 +118,7 @@ * @see TypeElement#getSimpleName * @see VariableElement#getSimpleName * @see ModuleElement#getSimpleName + * @see RecordComponentElement#getSimpleName * @revised 9 * @spec JPMS */ @@ -149,8 +150,8 @@ * element} which declares the parameter is returned. * * <li> If this is a {@linkplain - * VariableElement#getEnclosingElement record component}, - * {@linkplain ExecutableElement the type} which declares the + * RecordComponentElement#getEnclosingElement record component}, + * {@linkplain TypeElement the type} which declares the * record component is returned. * * <li> If this is a {@linkplain ModuleElement#getEnclosingElement
--- a/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java Mon Oct 07 12:55:23 2019 -0400 @@ -164,4 +164,19 @@ default R visitModule(ModuleElement e, P p) { return visitUnknown(e, p); } + + /** + * Visits a record component element. + * + * @implSpec The default implementation visits a {@code + * RecordComponentElement} by calling {@code visitUnknown(e, p)}. + * + * @param e the element to visit + * @param p a visitor-specified parameter + * @return a visitor-specified result + * @since 14 + */ + default R visitRecordComponent(RecordComponentElement e, P p) { + return visitUnknown(e, p); + } }
--- a/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java Mon Oct 07 12:55:23 2019 -0400 @@ -31,7 +31,7 @@ * @since 14 */ -public interface RecordComponentElement extends VariableElement { +public interface RecordComponentElement extends Element { /** * Returns the enclosing element of this record component. * @@ -44,6 +44,19 @@ Element getEnclosingElement(); /** + * Returns the simple name of this record component. + * + * <p>The name of each record component must be distinct from the + * names of all other record components. + * + * @return the simple name of this record component + * + * @jls 6.2 Names and Identifiers + */ + @Override + Name getSimpleName(); + + /** * Returns the executable element for the accessor associated with the * given record component. *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java Mon Oct 07 12:55:23 2019 -0400 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.lang.model.util; + +import javax.annotation.processing.SupportedSourceVersion; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.RecordComponentElement; +import static javax.lang.model.SourceVersion.*; + + +/** + * A skeletal visitor of program elements with default behavior + * appropriate for the {@link SourceVersion#RELEASE_14 RELEASE_14} + * source version. + * + * <p> <b>WARNING:</b> The {@code ElementVisitor} interface + * implemented by this class may have methods added to it in the + * future to accommodate new, currently unknown, language structures + * added to future versions of the Java™ programming language. + * Therefore, methods whose names begin with {@code "visit"} may be + * added to this class in the future; to avoid incompatibilities, + * classes which extend this class should not declare any instance + * methods with names beginning with {@code "visit"}. + * + * <p>When such a new visit method is added, the default + * implementation in this class will be to call the {@link + * #visitUnknown visitUnknown} method. A new abstract element visitor + * class will also be introduced to correspond to the new language + * level; this visitor will have different default behavior for the + * visit method in question. When the new visitor is introduced, all + * or portions of this visitor may be deprecated. + * + * @param <R> the return type of this visitor's methods. Use {@link + * Void} for visitors that do not need to return results. + * @param <P> the type of the additional parameter to this visitor's + * methods. Use {@code Void} for visitors that do not need an + * additional parameter. + * + * @see AbstractElementVisitor6 + * @see AbstractElementVisitor7 + * @see AbstractElementVisitor8 + * @see AbstractElementVisitor9 + * @since 14 + */ +@SupportedSourceVersion(RELEASE_14) +public abstract class AbstractElementVisitor14<R, P> extends AbstractElementVisitor9<R, P> { + /** + * Constructor for concrete subclasses to call. + */ + protected AbstractElementVisitor14(){ + super(); + } + + /** + * {@inheritDoc} + * + * @implSpec Visits a {@code RecordComponentElement} in a manner defined by a + * subclass. + * + * @param t {@inheritDoc} + * @param p {@inheritDoc} + * @return {@inheritDoc} + */ + @Override + public abstract R visitRecordComponent(RecordComponentElement t, P p); +}
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java Mon Oct 07 12:55:23 2019 -0400 @@ -66,6 +66,7 @@ * @see AbstractElementVisitor7 * @see AbstractElementVisitor8 * @see AbstractElementVisitor9 + * @see AbstractElementVisitor14 * @since 1.6 */ @SupportedSourceVersion(RELEASE_6) @@ -143,4 +144,22 @@ // Use implementation from interface default method return ElementVisitor.super.visitModule(e, p); } + + /** + * {@inheritDoc} + * + * @implSpec Visits a {@code RecordComponentElement} by calling {@code + * visitUnknown}. + * + * @param e {@inheritDoc} + * @param p {@inheritDoc} + * @return {@inheritDoc} + * + * @since 14 + */ + @Override + public R visitRecordComponent(RecordComponentElement e, P p) { + // Use implementation from interface default method + return ElementVisitor.super.visitRecordComponent(e, p); + } }
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor7.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor7.java Mon Oct 07 12:55:23 2019 -0400 @@ -61,6 +61,7 @@ * @see AbstractElementVisitor6 * @see AbstractElementVisitor8 * @see AbstractElementVisitor9 + * @see AbstractElementVisitor14 * @since 1.7 */ @SupportedSourceVersion(RELEASE_7)
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor8.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor8.java Mon Oct 07 12:55:23 2019 -0400 @@ -61,6 +61,7 @@ * @see AbstractElementVisitor6 * @see AbstractElementVisitor7 * @see AbstractElementVisitor9 + * @see AbstractElementVisitor14 * @since 1.8 */ @SupportedSourceVersion(RELEASE_8)
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java Mon Oct 07 12:55:23 2019 -0400 @@ -109,18 +109,29 @@ return setFilter(elements, FIELD_KINDS, VariableElement.class); } - // Method below may only be temporary /** * Returns a list of record components in {@code elements}. * @return a list of record components in {@code elements} * @param elements the elements to filter + * @since 14 */ public static List<RecordComponentElement> - recordComponentsIn(List<? extends Element> elements) { + recordComponentsIn(Iterable<? extends Element> elements) { return listFilter(elements, RECORD_COMPONENT_KIND, RecordComponentElement.class); } /** + * Returns a set of record components in {@code elements}. + * @return a set of record components in {@code elements} + * @param elements the elements to filter + * @since 14 + */ + public static Set<RecordComponentElement> + recordComponentsIn(Set<? extends Element> elements) { + return setFilter(elements, RECORD_COMPONENT_KIND, RecordComponentElement.class); + } + + /** * Returns a list of constructors in {@code elements}. * @return a list of constructors in {@code elements} * @param elements the elements to filter
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java Mon Oct 07 12:55:23 2019 -0400 @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.lang.model.util; + +import javax.lang.model.element.*; +import javax.annotation.processing.SupportedSourceVersion; +import static javax.lang.model.SourceVersion.*; +import javax.lang.model.SourceVersion; + +/** + * A visitor of program elements based on their {@linkplain + * ElementKind kind} with default behavior appropriate for the {@link + * SourceVersion#RELEASE_14 RELEASE_14} source version. + * + * For {@linkplain + * Element elements} <code><i>Xyz</i></code> that may have more than one + * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate + * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the + * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods + * call {@link #defaultAction defaultAction}, passing their arguments + * to {@code defaultAction}'s corresponding parameters. + * + * <p> Methods in this class may be overridden subject to their + * general contract. Note that annotating methods in concrete + * subclasses with {@link java.lang.Override @Override} will help + * ensure that methods are overridden as intended. + * + * <p> <b>WARNING:</b> The {@code ElementVisitor} interface + * implemented by this class may have methods added to it or the + * {@code ElementKind} {@code enum} used in this case may have + * constants added to it in the future to accommodate new, currently + * unknown, language structures added to future versions of the + * Java™ programming language. Therefore, methods whose names + * begin with {@code "visit"} may be added to this class in the + * future; to avoid incompatibilities, classes which extend this class + * should not declare any instance methods with names beginning with + * {@code "visit"}. + * + * <p>When such a new visit method is added, the default + * implementation in this class will be to call the {@link + * #visitUnknown visitUnknown} method. A new abstract element kind + * visitor class will also be introduced to correspond to the new + * language level; this visitor will have different default behavior + * for the visit method in question. When the new visitor is + * introduced, all or portions of this visitor may be deprecated. + * + * @param <R> the return type of this visitor's methods. Use {@link + * Void} for visitors that do not need to return results. + * @param <P> the type of the additional parameter to this visitor's + * methods. Use {@code Void} for visitors that do not need an + * additional parameter. + * + * @see ElementKindVisitor6 + * @see ElementKindVisitor7 + * @see ElementKindVisitor8 + * @see ElementKindVisitor9 + * @since 14 + */ +@SupportedSourceVersion(RELEASE_14) +public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> { + /** + * Constructor for concrete subclasses; uses {@code null} for the + * default value. + */ + protected ElementKindVisitor14() { + super(null); + } + + /** + * Constructor for concrete subclasses; uses the argument for the + * default value. + * + * @param defaultValue the value to assign to {@link #DEFAULT_VALUE} + */ + protected ElementKindVisitor14(R defaultValue) { + super(defaultValue); + } + + /** + * {@inheritDoc} + * + * @implSpec This implementation calls {@code defaultAction}. + * + * @param e the element to visit + * @param p a visitor-specified parameter + * @return the result of {@code defaultAction} + */ + @Override + public R visitRecordComponent(RecordComponentElement e, P p) { + return defaultAction(e, p); + } + + /** + * {@inheritDoc} + * + * @implSpec This implementation calls {@code defaultAction}. + *. + * @param e the element to visit + * @param p a visitor-specified parameter + * @return the result of {@code defaultAction} + */ + @Override + public R visitTypeAsRecord(TypeElement e, P p) { + return defaultAction(e, p); + } +}
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java Mon Oct 07 12:55:23 2019 -0400 @@ -80,6 +80,7 @@ * @see ElementKindVisitor7 * @see ElementKindVisitor8 * @see ElementKindVisitor9 + * @see ElementKindVisitor14 * @since 1.6 */ @SupportedSourceVersion(RELEASE_6) @@ -235,8 +236,7 @@ * @implSpec This implementation dispatches to the visit method for * the specific {@linkplain ElementKind kind} of variable, {@code * ENUM_CONSTANT}, {@code EXCEPTION_PARAMETER}, {@code FIELD}, - * {@code LOCAL_VARIABLE}, {@code PARAMETER}, {@code RESOURCE_VARIABLE}, - * or {@code RECORD_COMPONENT}. + * {@code LOCAL_VARIABLE}, {@code PARAMETER}, or {@code RESOURCE_VARIABLE}. * * @param e {@inheritDoc} * @param p {@inheritDoc} @@ -264,9 +264,6 @@ case RESOURCE_VARIABLE: return visitVariableAsResourceVariable(e, p); - case RECORD_COMPONENT: - return visitVariableAsRecordComponent(e, p); - default: throw new AssertionError("Bad kind " + k + " for VariableElement" + e); } @@ -353,21 +350,6 @@ } /** - * Visits a {@code RECORD_COMPONENT} variable element. - * - * @implSpec This implementation calls {@code visitUnknown}. - * - * @param e the element to visit - * @param p a visitor-specified parameter - * @return the result of {@code visitUnknown} - * - * @since amber - */ - public R visitVariableAsRecordComponent(VariableElement e, P p) { - return visitUnknown(e, p); - } - - /** * {@inheritDoc} * * @implSpec This implementation dispatches to the visit method
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor7.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor7.java Mon Oct 07 12:55:23 2019 -0400 @@ -74,6 +74,7 @@ * @see ElementKindVisitor6 * @see ElementKindVisitor8 * @see ElementKindVisitor9 + * @see ElementKindVisitor14 * @since 1.7 */ @SupportedSourceVersion(RELEASE_7)
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor8.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor8.java Mon Oct 07 12:55:23 2019 -0400 @@ -74,6 +74,7 @@ * @see ElementKindVisitor6 * @see ElementKindVisitor7 * @see ElementKindVisitor9 + * @see ElementKindVisitor14 * @since 1.8 */ @SupportedSourceVersion(RELEASE_8)
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitorRecord.java Mon Oct 07 15:14:32 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package javax.lang.model.util; - -import javax.lang.model.element.*; -import javax.annotation.processing.SupportedSourceVersion; -import static javax.lang.model.SourceVersion.*; -import javax.lang.model.SourceVersion; - -/** - * A visitor of program elements based on their {@linkplain - * ElementKind kind} with default behavior appropriate for source - * versions with records. - * - * For {@linkplain - * Element elements} <code><i>Xyz</i></code> that may have more than one - * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate - * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the - * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods - * call {@link #defaultAction defaultAction}, passing their arguments - * to {@code defaultAction}'s corresponding parameters. - * - * <p> Methods in this class may be overridden subject to their - * general contract. Note that annotating methods in concrete - * subclasses with {@link java.lang.Override @Override} will help - * ensure that methods are overridden as intended. - * - * <p> <b>WARNING:</b> The {@code ElementVisitor} interface - * implemented by this class may have methods added to it or the - * {@code ElementKind} {@code enum} used in this case may have - * constants added to it in the future to accommodate new, currently - * unknown, language structures added to future versions of the - * Java™ programming language. Therefore, methods whose names - * begin with {@code "visit"} may be added to this class in the - * future; to avoid incompatibilities, classes which extend this class - * should not declare any instance methods with names beginning with - * {@code "visit"}. - * - * <p>When such a new visit method is added, the default - * implementation in this class will be to call the {@link - * #visitUnknown visitUnknown} method. A new abstract element kind - * visitor class will also be introduced to correspond to the new - * language level; this visitor will have different default behavior - * for the visit method in question. When the new visitor is - * introduced, all or portions of this visitor may be deprecated. - * - * @param <R> the return type of this visitor's methods. Use {@link - * Void} for visitors that do not need to return results. - * @param <P> the type of the additional parameter to this visitor's - * methods. Use {@code Void} for visitors that do not need an - * additional parameter. - * - * @see ElementKindVisitor6 - * @see ElementKindVisitor7 - * @see ElementKindVisitor8 - * @since amber - */ -@SupportedSourceVersion(RELEASE_13) -public class ElementKindVisitorRecord<R, P> extends ElementKindVisitor9<R, P> { - /** - * Constructor for concrete subclasses; uses {@code null} for the - * default value. - */ - protected ElementKindVisitorRecord() { - super(null); - } - - /** - * Constructor for concrete subclasses; uses the argument for the - * default value. - * - * @param defaultValue the value to assign to {@link #DEFAULT_VALUE} - */ - protected ElementKindVisitorRecord(R defaultValue) { - super(defaultValue); - } - - /** - * {@inheritDoc} - * - * @implSpec This implementation calls {@code defaultAction}. - *. - * @param e the element to visit - * @param p a visitor-specified parameter - * @return the result of {@code defaultAction} - * - * @since amber - */ - @Override - public R visitTypeAsRecord(TypeElement e, P p) { - return defaultAction(e, p); - } - - /** - * {@inheritDoc} - * - * @implSpec This implementation calls {@code defaultAction}. - *. - * @param e the element to visit - * @param p a visitor-specified parameter - * @return the result of {@code defaultAction} - * - * @since amber - */ - @Override - public R visitVariableAsRecordComponent(VariableElement e, P p) { - return defaultAction(e, p); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java Mon Oct 07 12:55:23 2019 -0400 @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.lang.model.util; + +import javax.lang.model.element.*; +import javax.annotation.processing.SupportedSourceVersion; +import javax.lang.model.SourceVersion; +import static javax.lang.model.SourceVersion.*; + +/** + * A scanning visitor of program elements with default behavior + * appropriate for the {@link SourceVersion#RELEASE_14 RELEASE_14} + * source version. + * + * The <code>visit<i>Xyz</i></code> methods in this + * class scan their component elements by calling {@code scan} on + * their {@linkplain Element#getEnclosedElements enclosed elements}, + * {@linkplain ExecutableElement#getParameters parameters}, etc., as + * indicated in the individual method specifications. A subclass can + * control the order elements are visited by overriding the + * <code>visit<i>Xyz</i></code> methods. Note that clients of a scanner + * may get the desired behavior be invoking {@code v.scan(e, p)} rather + * than {@code v.visit(e, p)} on the root objects of interest. + * + * <p>When a subclass overrides a <code>visit<i>Xyz</i></code> method, the + * new method can cause the enclosed elements to be scanned in the + * default way by calling <code>super.visit<i>Xyz</i></code>. In this + * fashion, the concrete visitor can control the ordering of traversal + * over the component elements with respect to the additional + * processing; for example, consistently calling + * <code>super.visit<i>Xyz</i></code> at the start of the overridden + * methods will yield a preorder traversal, etc. If the component + * elements should be traversed in some other order, instead of + * calling <code>super.visit<i>Xyz</i></code>, an overriding visit method + * should call {@code scan} with the elements in the desired order. + * + * <p> Methods in this class may be overridden subject to their + * general contract. Note that annotating methods in concrete + * subclasses with {@link java.lang.Override @Override} will help + * ensure that methods are overridden as intended. + * + * <p> <b>WARNING:</b> The {@code ElementVisitor} interface + * implemented by this class may have methods added to it in the + * future to accommodate new, currently unknown, language structures + * added to future versions of the Java™ programming language. + * Therefore, methods whose names begin with {@code "visit"} may be + * added to this class in the future; to avoid incompatibilities, + * classes which extend this class should not declare any instance + * methods with names beginning with {@code "visit"}. + * + * <p>When such a new visit method is added, the default + * implementation in this class will be to call the {@link + * #visitUnknown visitUnknown} method. A new element scanner visitor + * class will also be introduced to correspond to the new language + * level; this visitor will have different default behavior for the + * visit method in question. When the new visitor is introduced, all + * or portions of this visitor may be deprecated. + * + * @param <R> the return type of this visitor's methods. Use {@link + * Void} for visitors that do not need to return results. + * @param <P> the type of the additional parameter to this visitor's + * methods. Use {@code Void} for visitors that do not need an + * additional parameter. + * + * @see ElementScanner6 + * @see ElementScanner7 + * @see ElementScanner8 + * @see ElementScanner9 + * @since 14 + */ +@SupportedSourceVersion(RELEASE_14) +public class ElementScanner14<R, P> extends ElementScanner9<R, P> { + /** + * Constructor for concrete subclasses; uses {@code null} for the + * default value. + */ + protected ElementScanner14(){ + super(null); + } + + /** + * Constructor for concrete subclasses; uses the argument for the + * default value. + * + * @param defaultValue the default value + */ + protected ElementScanner14(R defaultValue){ + super(defaultValue); + } + + /** + * {@inheritDoc} + * + * @implSpec This implementation scans the enclosed elements. + * + * @param e the element to visit + * @param p a visitor-specified parameter + * @return the result of the scan + */ + @Override + public R visitRecordComponent(RecordComponentElement e, P p) { + return scan(e.getEnclosedElements(), p); + } +}
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java Mon Oct 07 12:55:23 2019 -0400 @@ -91,6 +91,7 @@ * @see ElementScanner7 * @see ElementScanner8 * @see ElementScanner9 + * @see ElementScanner14 * @since 1.6 */ @SupportedSourceVersion(RELEASE_6)
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java Mon Oct 07 12:55:23 2019 -0400 @@ -87,6 +87,7 @@ * @see ElementScanner6 * @see ElementScanner8 * @see ElementScanner9 + * @see ElementScanner14 * @since 1.7 */ @SupportedSourceVersion(RELEASE_7)
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner8.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner8.java Mon Oct 07 12:55:23 2019 -0400 @@ -87,6 +87,7 @@ * @see ElementScanner6 * @see ElementScanner7 * @see ElementScanner9 + * @see ElementScanner14 * @since 1.8 */ @SupportedSourceVersion(RELEASE_8)
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java Mon Oct 07 12:55:23 2019 -0400 @@ -89,6 +89,7 @@ * @see ElementScanner6 * @see ElementScanner7 * @see ElementScanner8 + * @see ElementScanner14 * @since 9 * @spec JPMS */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java Mon Oct 07 12:55:23 2019 -0400 @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.lang.model.util; + +import javax.annotation.processing.SupportedSourceVersion; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.RecordComponentElement; +import static javax.lang.model.SourceVersion.*; + +/** + * A simple visitor of program elements with default behavior + * appropriate for the {@link SourceVersion#RELEASE_14 RELEASE_14} + * source version. + * + * Visit methods corresponding to {@code RELEASE_14} and earlier + * language constructs call {@link #defaultAction defaultAction}, + * passing their arguments to {@code defaultAction}'s corresponding + * parameters. + * + * <p> Methods in this class may be overridden subject to their + * general contract. Note that annotating methods in concrete + * subclasses with {@link java.lang.Override @Override} will help + * ensure that methods are overridden as intended. + * + * <p> <b>WARNING:</b> The {@code ElementVisitor} interface + * implemented by this class may have methods added to it in the + * future to accommodate new, currently unknown, language structures + * added to future versions of the Java™ programming language. + * Therefore, methods whose names begin with {@code "visit"} may be + * added to this class in the future; to avoid incompatibilities, + * classes which extend this class should not declare any instance + * methods with names beginning with {@code "visit"}. + * + * <p>When such a new visit method is added, the default + * implementation in this class will be to call the {@link + * #visitUnknown visitUnknown} method. A new simple element visitor + * class will also be introduced to correspond to the new language + * level; this visitor will have different default behavior for the + * visit method in question. When the new visitor is introduced, all + * or portions of this visitor may be deprecated. + * + * @param <R> the return type of this visitor's methods. Use {@code Void} + * for visitors that do not need to return results. + * @param <P> the type of the additional parameter to this visitor's methods. Use {@code Void} + * for visitors that do not need an additional parameter. + * + * @see SimpleElementVisitor6 + * @see SimpleElementVisitor7 + * @see SimpleElementVisitor8 + * @see SimpleElementVisitor9 + * @since 14 + */ +@SupportedSourceVersion(RELEASE_14) +public class SimpleElementVisitor14<R, P> extends SimpleElementVisitor9<R, P> { + /** + * Constructor for concrete subclasses; uses {@code null} for the + * default value. + */ + protected SimpleElementVisitor14(){ + super(null); + } + + /** + * Constructor for concrete subclasses; uses the argument for the + * default value. + * + * @param defaultValue the value to assign to {@link #DEFAULT_VALUE} + */ + protected SimpleElementVisitor14(R defaultValue){ + super(defaultValue); + } + + /** + * {@inheritDoc} + * + * @implSpec Visits a {@code RecordComponentElement} by calling {@code + * defaultAction}. + * + * @param e the element to visit + * @param p a visitor-specified parameter + * @return {@inheritDoc} + */ + @Override + public R visitRecordComponent(RecordComponentElement e, P p) { + return defaultAction(e, p); + } +}
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java Mon Oct 07 12:55:23 2019 -0400 @@ -77,6 +77,7 @@ * @see SimpleElementVisitor7 * @see SimpleElementVisitor8 * @see SimpleElementVisitor9 + * @see SimpleElementVisitor14 * @since 1.6 */ @SupportedSourceVersion(RELEASE_6)
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor7.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor7.java Mon Oct 07 12:55:23 2019 -0400 @@ -70,6 +70,7 @@ * @see SimpleElementVisitor6 * @see SimpleElementVisitor8 * @see SimpleElementVisitor9 + * @see SimpleElementVisitor14 * @since 1.7 */ @SupportedSourceVersion(RELEASE_7)
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor8.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor8.java Mon Oct 07 12:55:23 2019 -0400 @@ -69,6 +69,7 @@ * @see SimpleElementVisitor6 * @see SimpleElementVisitor7 * @see SimpleElementVisitor9 + * @see SimpleElementVisitor14 * @since 1.8 */ @SupportedSourceVersion(RELEASE_8)
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java Mon Oct 07 12:55:23 2019 -0400 @@ -70,6 +70,7 @@ * @see SimpleElementVisitor6 * @see SimpleElementVisitor7 * @see SimpleElementVisitor8 + * @see SimpleElementVisitor14 * @since 9 * @spec JPMS */
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Mon Oct 07 12:55:23 2019 -0400 @@ -972,7 +972,7 @@ * Leave class public for external testing purposes. */ public static class ComputeAnnotationSet extends - ElementScanner9<Set<TypeElement>, Set<TypeElement>> { + ElementScanner14<Set<TypeElement>, Set<TypeElement>> { final Elements elements; public ComputeAnnotationSet(Elements elements) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java Mon Oct 07 12:55:23 2019 -0400 @@ -109,9 +109,9 @@ /** * Returns the elements annotated with the given annotation type. * Only type elements <i>included</i> in this round of annotation - * processing, or declarations of members, parameters, or type - * parameters declared within those, are returned. Included type - * elements are {@linkplain #getRootElements specified + * processing, or declarations of members, parameters, type + * parameters, or record components declared within those, are returned. + * Included type elements are {@linkplain #getRootElements specified * types} and any types nested within them. * * @param a annotation type being requested @@ -123,7 +123,7 @@ throwIfNotAnnotation(a); Set<Element> result = Collections.emptySet(); - ElementScanner9<Set<Element>, TypeElement> scanner = + ElementScanner14<Set<Element>, TypeElement> scanner = new AnnotationSetScanner(result); for (Element element : rootElements) @@ -144,7 +144,7 @@ } Set<Element> result = Collections.emptySet(); - ElementScanner9<Set<Element>, Set<TypeElement>> scanner = + ElementScanner14<Set<Element>, Set<TypeElement>> scanner = new AnnotationSetMultiScanner(result); for (Element element : rootElements) @@ -224,7 +224,7 @@ } private static abstract class ElementScanningIncludingTypeParameters<R, P> - extends ElementScanner9<R, P> { + extends ElementScanner14<R, P> { protected ElementScanningIncludingTypeParameters(R defaultValue) { super(defaultValue);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Mon Oct 07 12:55:23 2019 -0400 @@ -91,7 +91,7 @@ * Used for the -Xprint option and called by Elements.printElements */ public static class PrintingElementVisitor - extends SimpleElementVisitor9<PrintingElementVisitor, Boolean> { + extends SimpleElementVisitor14<PrintingElementVisitor, Boolean> { int indentation; // Indentation level; final PrintWriter writer; final Elements elementUtils; @@ -125,7 +125,7 @@ enclosing != null && NestingKind.ANONYMOUS == // Use an anonymous class to determine anonymity! - (new SimpleElementVisitor9<NestingKind, Void>() { + (new SimpleElementVisitor14<NestingKind, Void>() { @Override @DefinedBy(Api.LANGUAGE_MODEL) public NestingKind visitType(TypeElement e, Void p) { return e.getNestingKind();
--- a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PubapiVisitor.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PubapiVisitor.java Mon Oct 07 12:55:23 2019 -0400 @@ -36,7 +36,7 @@ import javax.lang.model.element.TypeParameterElement; import javax.lang.model.element.VariableElement; import javax.lang.model.type.TypeMirror; -import javax.lang.model.util.ElementScanner9; +import javax.lang.model.util.ElementScanner14; import com.sun.tools.javac.code.Symbol.ClassSymbol; import com.sun.tools.javac.util.DefinedBy; @@ -56,7 +56,7 @@ * This code and its internal interfaces are subject to change or * deletion without notice.</b> */ -public class PubapiVisitor extends ElementScanner9<Void, Void> { +public class PubapiVisitor extends ElementScanner14<Void, Void> { private PubApi collectedApi = new PubApi();
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java Mon Oct 07 12:55:23 2019 -0400 @@ -38,7 +38,7 @@ import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; -import javax.lang.model.util.SimpleElementVisitor9; +import javax.lang.model.util.SimpleElementVisitor14; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.Entity; @@ -180,7 +180,7 @@ protected void addDescription(Content dl, Element element) { SearchIndexItem si = new SearchIndexItem(); - new SimpleElementVisitor9<Void, Void>() { + new SimpleElementVisitor14<Void, Void>() { @Override public Void visitModule(ModuleElement e, Void p) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Mon Oct 07 12:55:23 2019 -0400 @@ -51,7 +51,7 @@ import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.SimpleAnnotationValueVisitor9; -import javax.lang.model.util.SimpleElementVisitor9; +import javax.lang.model.util.SimpleElementVisitor14; import javax.lang.model.util.SimpleTypeVisitor9; import com.sun.source.doctree.AttributeTree; @@ -1666,7 +1666,7 @@ return text; } - DocPath redirectPathFromRoot = new SimpleElementVisitor9<DocPath, Void>() { + DocPath redirectPathFromRoot = new SimpleElementVisitor14<DocPath, Void>() { @Override public DocPath visitType(TypeElement e, Void p) { return docPaths.forPackage(utils.containingPackage(e));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Mon Oct 07 12:55:23 2019 -0400 @@ -36,7 +36,7 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import javax.lang.model.type.TypeMirror; -import javax.lang.model.util.SimpleElementVisitor9; +import javax.lang.model.util.SimpleElementVisitor14; import com.sun.source.doctree.DocTree; import com.sun.source.doctree.DocTree.Kind; @@ -456,7 +456,7 @@ si.setDescription(desc); si.setUrl(htmlWriter.path.getPath() + "#" + anchorName); DocPaths docPaths = configuration.docPaths; - new SimpleElementVisitor9<Void, Void>() { + new SimpleElementVisitor14<Void, Void>() { @Override public Void visitVariable(VariableElement e, Void p) { TypeElement te = utils.getEnclosingTypeElement(e);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java Mon Oct 07 12:55:23 2019 -0400 @@ -33,7 +33,7 @@ import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; -import javax.lang.model.util.SimpleElementVisitor9; +import javax.lang.model.util.SimpleElementVisitor14; import javax.tools.JavaFileManager; import javax.tools.JavaFileObject; @@ -1236,7 +1236,7 @@ : docEnv.getSpecifiedElements(); for (Element e : inset) { - new SimpleElementVisitor9<Void, Void>() { + new SimpleElementVisitor14<Void, Void>() { @Override @DefinedBy(Api.LANGUAGE_MODEL) public Void visitModule(ModuleElement e, Void p) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java Mon Oct 07 12:55:23 2019 -0400 @@ -34,7 +34,7 @@ import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; -import javax.lang.model.util.SimpleElementVisitor9; +import javax.lang.model.util.SimpleElementVisitor14; import javax.tools.JavaFileManager; import javax.tools.StandardJavaFileManager; @@ -365,7 +365,7 @@ if (element == null) { return; } - new SimpleElementVisitor9<Void, Void>() { + new SimpleElementVisitor14<Void, Void>() { @Override public Void visitModule(ModuleElement e, Void p) { if (!taglet.inModule()) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java Mon Oct 07 12:55:23 2019 -0400 @@ -41,7 +41,7 @@ import javax.lang.model.type.WildcardType; import javax.lang.model.util.ElementFilter; import javax.lang.model.util.Elements; -import javax.lang.model.util.SimpleElementVisitor9; +import javax.lang.model.util.SimpleElementVisitor14; import javax.lang.model.util.SimpleTypeVisitor9; import javax.lang.model.util.Types; @@ -483,8 +483,8 @@ private <T extends Element> void mapTypeParameters(final Map<TypeElement, List<T>> map, Element element, final T holder) { - SimpleElementVisitor9<Void, Void> elementVisitor - = new SimpleElementVisitor9<Void, Void>() { + SimpleElementVisitor14<Void, Void> elementVisitor + = new SimpleElementVisitor14<Void, Void>() { private void addParameters(TypeParameterElement e) { for (TypeMirror type : utils.getBounds(e)) { @@ -562,7 +562,7 @@ */ private <T extends Element> void mapAnnotations(final Map<TypeElement, List<T>> map, Element e, final T holder) { - new SimpleElementVisitor9<Void, Void>() { + new SimpleElementVisitor14<Void, Void>() { void addAnnotations(Element e) { for (AnnotationMirror a : e.getAnnotationMirrors()) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Mon Oct 07 12:55:23 2019 -0400 @@ -47,6 +47,7 @@ import javax.lang.model.element.ModuleElement; import javax.lang.model.element.ModuleElement.RequiresDirective; import javax.lang.model.element.PackageElement; +import javax.lang.model.element.RecordComponentElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeParameterElement; import javax.lang.model.element.VariableElement; @@ -60,9 +61,9 @@ import javax.lang.model.type.TypeVariable; import javax.lang.model.type.WildcardType; import javax.lang.model.util.ElementFilter; -import javax.lang.model.util.ElementKindVisitor9; +import javax.lang.model.util.ElementKindVisitor14; import javax.lang.model.util.Elements; -import javax.lang.model.util.SimpleElementVisitor9; +import javax.lang.model.util.SimpleElementVisitor14; import javax.lang.model.util.SimpleTypeVisitor9; import javax.lang.model.util.TypeKindVisitor9; import javax.lang.model.util.Types; @@ -311,7 +312,7 @@ } public boolean isAnnotationType(Element e) { - return new SimpleElementVisitor9<Boolean, Void>() { + return new SimpleElementVisitor14<Boolean, Void>() { @Override public Boolean visitExecutable(ExecutableElement e, Void p) { return visit(e.getEnclosingElement()); @@ -431,17 +432,17 @@ public boolean isCanonicalRecordConstructor(ExecutableElement ee) { TypeElement te = (TypeElement) ee.getEnclosingElement(); - List<? extends VariableElement> stateComps = te.getRecordComponents(); + List<? extends RecordComponentElement> stateComps = te.getRecordComponents(); List<? extends VariableElement> params = ee.getParameters(); if (stateComps.size() != params.size()) { return false; } - Iterator<? extends VariableElement> stateIter = stateComps.iterator(); + Iterator<? extends RecordComponentElement> stateIter = stateComps.iterator(); Iterator<? extends VariableElement> paramIter = params.iterator(); while (paramIter.hasNext() && stateIter.hasNext()) { VariableElement param = paramIter.next(); - VariableElement comp = stateIter.next(); + RecordComponentElement comp = stateIter.next(); if (!Objects.equals(param.getSimpleName(), comp.getSimpleName()) || !typeUtils.isSameType(param.asType(), comp.asType())) { return false; @@ -470,7 +471,7 @@ modifiers.remove(SYNCHRONIZED); modifiers.remove(SEALED); - return new ElementKindVisitor9<String, SortedSet<Modifier>>() { + return new ElementKindVisitor14<String, SortedSet<Modifier>>() { final StringBuilder sb = new StringBuilder(); void addVisibilityModifier(Set<Modifier> modifiers) { @@ -1968,7 +1969,7 @@ } public String getFullyQualifiedName(Element e, final boolean outer) { - return new SimpleElementVisitor9<String, Void>() { + return new SimpleElementVisitor14<String, Void>() { @Override public String visitModule(ModuleElement e, Void p) { return e.getQualifiedName().toString(); @@ -2142,7 +2143,7 @@ } boolean hasParameters(Element e) { - return new SimpleElementVisitor9<Boolean, Void>() { + return new SimpleElementVisitor14<Boolean, Void>() { @Override public Boolean visitExecutable(ExecutableElement e, Void p) { return true; @@ -2163,7 +2164,7 @@ * than, equal to, or greater than the second. */ private String getFullyQualifiedName(Element e) { - return new SimpleElementVisitor9<String, Void>() { + return new SimpleElementVisitor14<String, Void>() { @Override public String visitModule(ModuleElement e, Void p) { return e.getQualifiedName().toString(); @@ -2526,7 +2527,7 @@ List<Element> getItems(Element e, boolean filter, ElementKind select) { List<Element> elements = new ArrayList<>(); - return new SimpleElementVisitor9<List<Element>, Void>() { + return new SimpleElementVisitor14<List<Element>, Void>() { @Override public List<Element> visitPackage(PackageElement e, Void p) { @@ -2571,11 +2572,11 @@ return elements; } - private SimpleElementVisitor9<Boolean, Void> shouldDocumentVisitor = null; + private SimpleElementVisitor14<Boolean, Void> shouldDocumentVisitor = null; public boolean shouldDocument(Element e) { if (shouldDocumentVisitor == null) { - shouldDocumentVisitor = new SimpleElementVisitor9<Boolean, Void>() { + shouldDocumentVisitor = new SimpleElementVisitor14<Boolean, Void>() { private boolean hasSource(TypeElement e) { return configuration.docEnv.getFileKind(e) == javax.tools.JavaFileObject.Kind.SOURCE; @@ -2625,11 +2626,11 @@ return nameCache.computeIfAbsent(e, this::getSimpleName0); } - private SimpleElementVisitor9<String, Void> snvisitor = null; + private SimpleElementVisitor14<String, Void> snvisitor = null; private String getSimpleName0(Element e) { if (snvisitor == null) { - snvisitor = new SimpleElementVisitor9<String, Void>() { + snvisitor = new SimpleElementVisitor14<String, Void>() { @Override public String visitModule(ModuleElement e, Void p) { return e.getQualifiedName().toString(); // temp fix for 8182736 @@ -2810,10 +2811,10 @@ return configuration.docEnv.isIncluded(e); } - private SimpleElementVisitor9<Boolean, Void> specifiedVisitor = null; + private SimpleElementVisitor14<Boolean, Void> specifiedVisitor = null; public boolean isSpecified(Element e) { if (specifiedVisitor == null) { - specifiedVisitor = new SimpleElementVisitor9<Boolean, Void>() { + specifiedVisitor = new SimpleElementVisitor14<Boolean, Void>() { @Override public Boolean visitModule(ModuleElement e, Void p) { return configuration.getSpecifiedModuleElements().contains(e);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java Mon Oct 07 12:55:23 2019 -0400 @@ -32,7 +32,7 @@ import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Elements; -import javax.lang.model.util.SimpleElementVisitor9; +import javax.lang.model.util.SimpleElementVisitor14; import java.lang.ref.SoftReference; import java.util.ArrayList; import java.util.Collections; @@ -704,7 +704,7 @@ } String getMemberKey(Element e) { - return new SimpleElementVisitor9<String, Void>() { + return new SimpleElementVisitor14<String, Void>() { @Override public String visitExecutable(ExecutableElement e, Void aVoid) { return e.getSimpleName() + ":" + e.getParameters().size();
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java Mon Oct 07 15:14:32 2019 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java Mon Oct 07 12:55:23 2019 -0400 @@ -47,7 +47,7 @@ import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.util.ElementFilter; -import javax.lang.model.util.SimpleElementVisitor9; +import javax.lang.model.util.SimpleElementVisitor14; import javax.tools.JavaFileManager; import javax.tools.JavaFileManager.Location; import javax.tools.JavaFileObject; @@ -985,7 +985,7 @@ return (xclasses || toolEnv.getFileKind(te) == SOURCE) && isSelected(te); } - SimpleElementVisitor9<Boolean, Void> visibleElementVisitor = null; + SimpleElementVisitor14<Boolean, Void> visibleElementVisitor = null; /** * Returns true if the element is selected, by applying * the access filter checks. Special treatment is applied to @@ -1001,7 +1001,7 @@ return false; } if (visibleElementVisitor == null) { - visibleElementVisitor = new SimpleElementVisitor9<Boolean, Void>() { + visibleElementVisitor = new SimpleElementVisitor14<Boolean, Void>() { @Override public Boolean visitType(TypeElement e, Void p) { if (!accessFilter.checkModifier(e)) { @@ -1035,7 +1035,7 @@ return visibleElementVisitor.visit(e); } - private class IncludedVisitor extends SimpleElementVisitor9<Boolean, Void> { + private class IncludedVisitor extends SimpleElementVisitor14<Boolean, Void> { final private Set<Element> includedCache; public IncludedVisitor() {
--- a/test/langtools/jdk/javadoc/tool/modules/ModuleTestBase.java Mon Oct 07 15:14:32 2019 +0000 +++ b/test/langtools/jdk/javadoc/tool/modules/ModuleTestBase.java Mon Oct 07 12:55:23 2019 -0400 @@ -41,7 +41,7 @@ import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.util.ElementFilter; -import javax.lang.model.util.SimpleElementVisitor9; +import javax.lang.model.util.SimpleElementVisitor14; import jdk.javadoc.doclet.Doclet; import jdk.javadoc.doclet.DocletEnvironment; @@ -301,7 +301,7 @@ void printDataSet(String header, Set<? extends Element> set) { for (Element e : set) { ps.print(header); - new SimpleElementVisitor9<Void, Void>() { + new SimpleElementVisitor14<Void, Void>() { @Override public Void visitModule(ModuleElement e, Void p) { ps.print(FS); @@ -347,7 +347,7 @@ @Override protected Void defaultAction(Element e, Void p) { Element encl = e.getEnclosingElement(); - CharSequence fqn = new SimpleElementVisitor9<CharSequence, Void>() { + CharSequence fqn = new SimpleElementVisitor14<CharSequence, Void>() { @Override public CharSequence visitModule(ModuleElement e, Void p) { return e.getQualifiedName();
--- a/test/langtools/jdk/javadoc/tool/reporter_generates_warnings/pkg/MyDoclet.java Mon Oct 07 15:14:32 2019 +0000 +++ b/test/langtools/jdk/javadoc/tool/reporter_generates_warnings/pkg/MyDoclet.java Mon Oct 07 12:55:23 2019 -0400 @@ -28,7 +28,7 @@ import java.util.Set; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; -import javax.lang.model.util.ElementScanner9; +import javax.lang.model.util.ElementScanner14; import javax.tools.Diagnostic; import jdk.javadoc.doclet.Doclet; @@ -94,7 +94,7 @@ return OK; } - class MyScanner extends ElementScanner9<Void, Integer> { + class MyScanner extends ElementScanner14<Void, Integer> { @Override public Void scan(Element e, Integer depth) { String msg = e.getKind() + " " + e;
--- a/test/langtools/tools/javac/6402516/CheckLocalElements.java Mon Oct 07 15:14:32 2019 +0000 +++ b/test/langtools/tools/javac/6402516/CheckLocalElements.java Mon Oct 07 12:55:23 2019 -0400 @@ -115,7 +115,7 @@ return encl == null ? "" : encl.accept(qualNameVisitor, null); } - private ElementVisitor<String,Void> qualNameVisitor = new SimpleElementVisitor9<String,Void>() { + private ElementVisitor<String,Void> qualNameVisitor = new SimpleElementVisitor14<String,Void>() { protected String defaultAction(Element e, Void ignore) { return ""; }
--- a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java Mon Oct 07 15:14:32 2019 +0000 +++ b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java Mon Oct 07 12:55:23 2019 -0400 @@ -122,7 +122,7 @@ } @SupportedSourceVersion(RELEASE_14) - public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor9<R, P> { + public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor14<R, P> { /** * Constructor for concrete subclasses to call. */ @@ -142,7 +142,7 @@ } @SupportedSourceVersion(RELEASE_14) - public static class ElementKindVisitor<R, P> extends ElementKindVisitor9<R, P> { + public static class ElementKindVisitor<R, P> extends ElementKindVisitor14<R, P> { /** * Constructor for concrete subclasses; uses {@code null} for the * default value. @@ -163,7 +163,7 @@ } @SupportedSourceVersion(RELEASE_14) - public static class ElementScanner<R, P> extends ElementScanner9<R, P> { + public static class ElementScanner<R, P> extends ElementScanner14<R, P> { /** * Constructor for concrete subclasses; uses {@code null} for the * default value. @@ -203,7 +203,7 @@ } @SupportedSourceVersion(RELEASE_14) - public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor9<R, P> { + public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor14<R, P> { /** * Constructor for concrete subclasses; uses {@code null} for the * default value.
--- a/test/langtools/tools/javac/modules/AnnotationProcessing.java Mon Oct 07 15:14:32 2019 +0000 +++ b/test/langtools/tools/javac/modules/AnnotationProcessing.java Mon Oct 07 12:55:23 2019 -0400 @@ -75,7 +75,7 @@ import javax.lang.model.element.VariableElement; import javax.lang.model.type.TypeKind; import javax.lang.model.util.ElementFilter; -import javax.lang.model.util.ElementScanner9; +import javax.lang.model.util.ElementScanner14; import javax.tools.Diagnostic.Kind; import javax.tools.FileObject; import javax.tools.JavaCompiler; @@ -189,7 +189,7 @@ boolean[] seenModule = new boolean[1]; - module.accept(new ElementScanner9<Void, Void>() { + module.accept(new ElementScanner14<Void, Void>() { @Override public Void visitModule(ModuleElement e, Void p) { seenModule[0] = true;
--- a/test/langtools/tools/javac/processing/model/TestSymtabItems.java Mon Oct 07 15:14:32 2019 +0000 +++ b/test/langtools/tools/javac/processing/model/TestSymtabItems.java Mon Oct 07 12:55:23 2019 -0400 @@ -122,7 +122,7 @@ int errors; - class ElemPrinter extends ElementScanner9<Void, Void> { + class ElemPrinter extends ElementScanner14<Void, Void> { @Override public Void visitModule(ModuleElement e, Void p) { show("module", e);
--- a/test/langtools/tools/javac/records/OriginTest.java Mon Oct 07 15:14:32 2019 +0000 +++ b/test/langtools/tools/javac/records/OriginTest.java Mon Oct 07 12:55:23 2019 -0400 @@ -35,7 +35,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.lang.model.element.ExecutableElement; -import javax.lang.model.util.ElementScanner9; +import javax.lang.model.util.ElementScanner14; import javax.lang.model.util.Elements; import javax.tools.JavaCompiler; import javax.tools.JavaFileObject; @@ -108,7 +108,7 @@ public void started(TaskEvent e) { System.err.println("Started " + e); if (e.getKind() == TaskEvent.Kind.ANALYZE) { - ElementScanner9<Void, Void> scanner = new ElementScanner9<>() { + ElementScanner14<Void, Void> scanner = new ElementScanner14<>() { public Void visitExecutable(ExecutableElement ee, Void p) { Elements.Origin o = elements.getOrigin(ee); if (o != expectedOrigin) {
--- a/test/langtools/tools/javac/records/annotations/JavaxLangModelForRecords.java Mon Oct 07 15:14:32 2019 +0000 +++ b/test/langtools/tools/javac/records/annotations/JavaxLangModelForRecords.java Mon Oct 07 12:55:23 2019 -0400 @@ -42,11 +42,12 @@ import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; +import javax.lang.model.element.RecordComponentElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import javax.lang.model.type.TypeKind; import javax.lang.model.util.ElementFilter; -import javax.lang.model.util.ElementScanner9; +import javax.lang.model.util.ElementScanner14; import javax.tools.Diagnostic.Kind; import javax.tools.*; @@ -135,7 +136,7 @@ for (VariableElement field : ElementFilter.fieldsIn(clazz.getEnclosedElements())) { messager.printMessage(Kind.NOTE, "field: " + field.getSimpleName()); } - for (VariableElement rc : ElementFilter.recordComponentsIn(clazz.getEnclosedElements())) { + for (RecordComponentElement rc : ElementFilter.recordComponentsIn(clazz.getEnclosedElements())) { messager.printMessage(Kind.NOTE, "record component: " + rc.getSimpleName()); } }