8050430: Provided new utility visitors supporting SourceVersion.RELEASE_9

Reviewed-by: jjg
This commit is contained in:
Joe Darcy 2014-07-17 09:47:25 -07:00
parent aa91971a3c
commit dee421ed14
53 changed files with 958 additions and 128 deletions

View File

@ -749,7 +749,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
* Leave class public for external testing purposes.
*/
public static class ComputeAnnotationSet extends
ElementScanner8<Set<TypeElement>, Set<TypeElement>> {
ElementScanner9<Set<TypeElement>, Set<TypeElement>> {
final Elements elements;
public ComputeAnnotationSet(Elements elements) {

View File

@ -114,7 +114,7 @@ public class JavacRoundEnvironment implements RoundEnvironment {
if (a.getKind() != ElementKind.ANNOTATION_TYPE)
throw new IllegalArgumentException(NOT_AN_ANNOTATION_TYPE + a);
ElementScanner8<Set<Element>, TypeElement> scanner =
ElementScanner9<Set<Element>, TypeElement> scanner =
new AnnotationSetScanner(result);
for (Element element : rootElements)
@ -125,7 +125,7 @@ public class JavacRoundEnvironment implements RoundEnvironment {
// Could be written as a local class inside getElementsAnnotatedWith
private class AnnotationSetScanner extends
ElementScanner8<Set<Element>, TypeElement> {
ElementScanner9<Set<Element>, TypeElement> {
// Insertion-order preserving set
Set<Element> annotatedElements = new LinkedHashSet<>();

View File

@ -83,7 +83,7 @@ public class PrintingProcessor extends AbstractProcessor {
* Used for the -Xprint option and called by Elements.printElements
*/
public static class PrintingElementVisitor
extends SimpleElementVisitor8<PrintingElementVisitor, Boolean> {
extends SimpleElementVisitor9<PrintingElementVisitor, Boolean> {
int indentation; // Indentation level;
final PrintWriter writer;
final Elements elementUtils;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2014, 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
@ -60,7 +60,7 @@ import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVisitor;
import javax.lang.model.util.ElementFilter;
import javax.lang.model.util.SimpleTypeVisitor8;
import javax.lang.model.util.SimpleTypeVisitor9;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic;
@ -738,7 +738,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
}
private TypeVisitor<Void,Types> checkMethodParametersVisitor =
new SimpleTypeVisitor8<Void,Types>() {
new SimpleTypeVisitor9<Void,Types>() {
@Override
public Void visitArray(ArrayType t, Types types) {
visit(t.getComponentType(), types);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2014, 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
@ -45,7 +45,7 @@ import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVisitor;
import javax.lang.model.util.ElementFilter;
import javax.lang.model.util.SimpleTypeVisitor8;
import javax.lang.model.util.SimpleTypeVisitor9;
/*
* <p><b>This is NOT part of any supported API.
@ -628,7 +628,7 @@ public class LLNI extends Gen {
}
protected final boolean isLongOrDouble(TypeMirror t) {
TypeVisitor<Boolean,Void> v = new SimpleTypeVisitor8<Boolean,Void>() {
TypeVisitor<Boolean,Void> v = new SimpleTypeVisitor9<Boolean,Void>() {
public Boolean defaultAction(TypeMirror t, Void p){
return false;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2014, 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
@ -38,7 +38,7 @@ import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVariable;
import javax.lang.model.type.TypeVisitor;
import javax.lang.model.util.Elements;
import javax.lang.model.util.SimpleTypeVisitor8;
import javax.lang.model.util.SimpleTypeVisitor9;
/**
* Returns internal type signature.
@ -248,7 +248,7 @@ public class TypeSignature {
String qualifiedTypeName(TypeMirror type) {
TypeVisitor<Name, Void> v = new SimpleTypeVisitor8<Name, Void>() {
TypeVisitor<Name, Void> v = new SimpleTypeVisitor9<Name, Void>() {
@Override
public Name visitArray(ArrayType t, Void p) {
return t.getComponentType().accept(this, p);

View File

@ -32,7 +32,7 @@ import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.ElementScanner6;
import javax.lang.model.util.ElementScanner9;
/** Utility class that constructs a textual representation
* of the public api of a class.
@ -42,7 +42,7 @@ import javax.lang.model.util.ElementScanner6;
* risk. This code and its internal interfaces are subject to change
* or deletion without notice.</b></p>
*/
public class PubapiVisitor extends ElementScanner6<Void, Void> {
public class PubapiVisitor extends ElementScanner9<Void, Void> {
StringBuffer sb;
// Important that it is 1! Part of protocol over wire, silly yes.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, 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
@ -73,8 +73,6 @@ import javax.lang.model.util.*;
* @author Joseph D. Darcy
* @author Scott Seligman
* @author Peter von der Ah&eacute;
* @see AbstractElementVisitor6
* @see AbstractElementVisitor7
* @since 1.6
*/
public interface ElementVisitor<R, P> {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, 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
@ -72,8 +72,12 @@ import javax.annotation.processing.SupportedSourceVersion;
*
* @see AbstractAnnotationValueVisitor7
* @see AbstractAnnotationValueVisitor8
* @see AbstractAnnotationValueVisitor9
* @since 1.6
* @deprecated Release 6 is obsolete; update to a visitor for a newer
* release level.
*/
@Deprecated
@SupportedSourceVersion(RELEASE_6)
public abstract class AbstractAnnotationValueVisitor6<R, P>
implements AnnotationValueVisitor<R, P> {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -65,6 +65,7 @@ import javax.annotation.processing.SupportedSourceVersion;
*
* @see AbstractAnnotationValueVisitor6
* @see AbstractAnnotationValueVisitor8
* @see AbstractAnnotationValueVisitor9
* @since 1.7
*/
@SupportedSourceVersion(RELEASE_7)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
@ -65,6 +65,7 @@ import javax.annotation.processing.SupportedSourceVersion;
*
* @see AbstractAnnotationValueVisitor6
* @see AbstractAnnotationValueVisitor7
* @see AbstractAnnotationValueVisitor9
* @since 1.8
*/
@SupportedSourceVersion(RELEASE_8)

View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 2011, 2014, 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 static javax.lang.model.SourceVersion.*;
import javax.lang.model.SourceVersion;
import javax.annotation.processing.SupportedSourceVersion;
/**
* A skeletal visitor for annotation values with default behavior
* appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
* source version.
*
* <p> <b>WARNING:</b> The {@code AnnotationValueVisitor} 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&trade; 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 annotation
* value 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
* @param <P> the type of the additional parameter to this visitor's methods.
*
* @see AbstractAnnotationValueVisitor6
* @see AbstractAnnotationValueVisitor7
* @see AbstractAnnotationValueVisitor8
* @since 1.9
*/
@SupportedSourceVersion(RELEASE_9)
public abstract class AbstractAnnotationValueVisitor9<R, P> extends AbstractAnnotationValueVisitor8<R, P> {
/**
* Constructor for concrete subclasses to call.
*/
protected AbstractAnnotationValueVisitor9() {
super();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, 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
@ -74,8 +74,12 @@ import static javax.lang.model.SourceVersion.*;
*
* @see AbstractElementVisitor7
* @see AbstractElementVisitor8
* @see AbstractElementVisitor9
* @since 1.6
* @deprecated Release 6 is obsolete; update to a visitor for a newer
* release level.
*/
@Deprecated
@SupportedSourceVersion(RELEASE_6)
public abstract class AbstractElementVisitor6<R, P> implements ElementVisitor<R, P> {
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -69,6 +69,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see AbstractElementVisitor6
* @see AbstractElementVisitor8
* @see AbstractElementVisitor9
* @since 1.7
*/
@SupportedSourceVersion(RELEASE_7)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
@ -69,6 +69,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see AbstractElementVisitor6
* @see AbstractElementVisitor7
* @see AbstractElementVisitor9
* @since 1.8
*/
@SupportedSourceVersion(RELEASE_8)

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2011, 2014, 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 static javax.lang.model.SourceVersion.*;
/**
* A skeletal visitor of program elements with default behavior
* appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
* 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&trade; 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
* @since 1.9
*/
@SupportedSourceVersion(RELEASE_9)
public abstract class AbstractElementVisitor9<R, P> extends AbstractElementVisitor8<R, P> {
/**
* Constructor for concrete subclasses to call.
*/
protected AbstractElementVisitor9(){
super();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, 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
@ -25,8 +25,11 @@
package javax.lang.model.util;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.type.*;
import static javax.lang.model.SourceVersion.*;
/**
* A skeletal visitor of types with default behavior appropriate for
* the {@link javax.lang.model.SourceVersion#RELEASE_6 RELEASE_6}
@ -70,8 +73,13 @@ import javax.lang.model.type.*;
*
* @see AbstractTypeVisitor7
* @see AbstractTypeVisitor8
* @see AbstractTypeVisitor9
* @since 1.6
* @deprecated Release 6 is obsolete; update to a visitor for a newer
* release level.
*/
@Deprecated
@SupportedSourceVersion(RELEASE_6)
public abstract class AbstractTypeVisitor6<R, P> implements TypeVisitor<R, P> {
/**
* Constructor for concrete subclasses to call.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -25,8 +25,11 @@
package javax.lang.model.util;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.type.*;
import static javax.lang.model.SourceVersion.*;
/**
* A skeletal visitor of types with default behavior appropriate for
* the {@link javax.lang.model.SourceVersion#RELEASE_7 RELEASE_7}
@ -66,8 +69,10 @@ import javax.lang.model.type.*;
*
* @see AbstractTypeVisitor6
* @see AbstractTypeVisitor8
* @see AbstractTypeVisitor9
* @since 1.7
*/
@SupportedSourceVersion(RELEASE_7)
public abstract class AbstractTypeVisitor7<R, P> extends AbstractTypeVisitor6<R, P> {
/**
* Constructor for concrete subclasses to call.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
@ -25,8 +25,11 @@
package javax.lang.model.util;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.type.*;
import static javax.lang.model.SourceVersion.*;
/**
* A skeletal visitor of types with default behavior appropriate for
* the {@link javax.lang.model.SourceVersion#RELEASE_8 RELEASE_8}
@ -66,8 +69,10 @@ import javax.lang.model.type.*;
*
* @see AbstractTypeVisitor6
* @see AbstractTypeVisitor7
* @see AbstractTypeVisitor9
* @since 1.8
*/
@SupportedSourceVersion(RELEASE_8)
public abstract class AbstractTypeVisitor8<R, P> extends AbstractTypeVisitor7<R, P> {
/**
* Constructor for concrete subclasses to call.

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2011, 2014, 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.type.*;
import static javax.lang.model.SourceVersion.*;
/**
* A skeletal visitor of types with default behavior appropriate for
* the {@link javax.lang.model.SourceVersion#RELEASE_9 RELEASE_9}
* source version.
*
* <p> <b>WARNING:</b> The {@code TypeVisitor} 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&trade; 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 type 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 AbstractTypeVisitor6
* @see AbstractTypeVisitor7
* @see AbstractTypeVisitor8
* @since 1.9
*/
@SupportedSourceVersion(RELEASE_9)
public abstract class AbstractTypeVisitor9<R, P> extends AbstractTypeVisitor8<R, P> {
/**
* Constructor for concrete subclasses to call.
*/
protected AbstractTypeVisitor9() {
super();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, 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
@ -88,8 +88,12 @@ import javax.lang.model.SourceVersion;
*
* @see ElementKindVisitor7
* @see ElementKindVisitor8
* @see ElementKindVisitor9
* @since 1.6
* @deprecated Release 6 is obsolete; update to a visitor for a newer
* release level.
*/
@Deprecated
@SupportedSourceVersion(RELEASE_6)
public class ElementKindVisitor6<R, P>
extends SimpleElementVisitor6<R, P> {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -82,6 +82,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see ElementKindVisitor6
* @see ElementKindVisitor8
* @see ElementKindVisitor9
* @since 1.7
*/
@SupportedSourceVersion(RELEASE_7)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
@ -82,6 +82,7 @@ import javax.lang.model.SourceVersion;
*
* @see ElementKindVisitor6
* @see ElementKindVisitor7
* @see ElementKindVisitor9
* @since 1.8
*/
@SupportedSourceVersion(RELEASE_8)

View File

@ -0,0 +1,98 @@
/*
* Copyright (c) 2011, 2014, 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_9 RELEASE_9} source version. For {@linkplain
* Element elements} <tt><i>XYZ</i></tt> that may have more than one
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> 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&trade; 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 1.9
*/
@SupportedSourceVersion(RELEASE_9)
public class ElementKindVisitor9<R, P> extends ElementKindVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
* default value.
*/
protected ElementKindVisitor9() {
super(null);
}
/**
* Constructor for concrete subclasses; uses the argument for the
* default value.
*
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
*/
protected ElementKindVisitor9(R defaultValue) {
super(defaultValue);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, 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
@ -90,8 +90,12 @@ import static javax.lang.model.SourceVersion.*;
*
* @see ElementScanner7
* @see ElementScanner8
* @see ElementScanner9
* @since 1.6
* @deprecated Release 6 is obsolete; update to a visitor for a newer
* release level.
*/
@Deprecated
@SupportedSourceVersion(RELEASE_6)
public class ElementScanner6<R, P> extends AbstractElementVisitor6<R, P> {
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -86,6 +86,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see ElementScanner6
* @see ElementScanner8
* @see ElementScanner9
* @since 1.7
*/
@SupportedSourceVersion(RELEASE_7)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
@ -86,6 +86,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see ElementScanner6
* @see ElementScanner7
* @see ElementScanner9
* @since 1.8
*/
@SupportedSourceVersion(RELEASE_8)

View File

@ -0,0 +1,111 @@
/*
* Copyright (c) 2011, 2014, 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_9 RELEASE_9}
* source version. The <tt>visit<i>XYZ</i></tt> 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
* <tt>visit<i>XYZ</i></tt> 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 <tt>visit<i>XYZ</i></tt> method, the
* new method can cause the enclosed elements to be scanned in the
* default way by calling <tt>super.visit<i>XYZ</i></tt>. 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
* <tt>super.visit<i>XYZ</i></tt> 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 <tt>super.visit<i>XYZ</i></tt>, 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&trade; 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
* @since 1.9
*/
@SupportedSourceVersion(RELEASE_9)
public class ElementScanner9<R, P> extends ElementScanner8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
* default value.
*/
protected ElementScanner9(){
super(null);
}
/**
* Constructor for concrete subclasses; uses the argument for the
* default value.
*
* @param defaultValue the default value
*/
protected ElementScanner9(R defaultValue){
super(defaultValue);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, 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
@ -81,8 +81,12 @@ import javax.annotation.processing.SupportedSourceVersion;
*
* @see SimpleAnnotationValueVisitor7
* @see SimpleAnnotationValueVisitor8
* @see SimpleAnnotationValueVisitor9
* @since 1.6
* @deprecated Release 6 is obsolete; update to a visitor for a newer
* release level.
*/
@Deprecated
@SupportedSourceVersion(RELEASE_6)
public class SimpleAnnotationValueVisitor6<R, P>
extends AbstractAnnotationValueVisitor6<R, P> {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -72,6 +72,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see SimpleAnnotationValueVisitor6
* @see SimpleAnnotationValueVisitor8
* @see SimpleAnnotationValueVisitor9
* @since 1.7
*/
@SupportedSourceVersion(RELEASE_7)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
@ -72,6 +72,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see SimpleAnnotationValueVisitor6
* @see SimpleAnnotationValueVisitor7
* @see SimpleAnnotationValueVisitor8
* @since 1.8
*/
@SupportedSourceVersion(RELEASE_8)

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2011, 2014, 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 static javax.lang.model.SourceVersion.*;
/**
* A simple visitor for annotation values with default behavior
* appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
* source version. Visit 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 AnnotationValueVisitor} 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&trade; 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 annotation
* value 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
* @param <P> the type of the additional parameter to this visitor's methods.
*
* @see SimpleAnnotationValueVisitor6
* @see SimpleAnnotationValueVisitor7
* @see SimpleAnnotationValueVisitor8
* @since 1.9
*/
@SupportedSourceVersion(RELEASE_9)
public class SimpleAnnotationValueVisitor9<R, P> extends SimpleAnnotationValueVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
* default value.
*/
protected SimpleAnnotationValueVisitor9() {
super(null);
}
/**
* Constructor for concrete subclasses; uses the argument for the
* default value.
*
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
*/
protected SimpleAnnotationValueVisitor9(R defaultValue) {
super(defaultValue);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, 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
@ -85,8 +85,12 @@ import static javax.lang.model.SourceVersion.*;
*
* @see SimpleElementVisitor7
* @see SimpleElementVisitor8
* @see SimpleElementVisitor9
* @since 1.6
* @deprecated Release 6 is obsolete; update to a visitor for a newer
* release level.
*/
@Deprecated
@SupportedSourceVersion(RELEASE_6)
public class SimpleElementVisitor6<R, P> extends AbstractElementVisitor6<R, P> {
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -78,6 +78,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see SimpleElementVisitor6
* @see SimpleElementVisitor8
* @see SimpleElementVisitor9
* @since 1.7
*/
@SupportedSourceVersion(RELEASE_7)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
@ -34,7 +34,7 @@ import static javax.lang.model.SourceVersion.*;
* appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
* source version.
*
* Visit methods corresponding to {@code RELEASE_7} and earlier
* Visit methods corresponding to {@code RELEASE_8} and earlier
* language constructs call {@link #defaultAction defaultAction},
* passing their arguments to {@code defaultAction}'s corresponding
* parameters.
@ -77,6 +77,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see SimpleElementVisitor6
* @see SimpleElementVisitor7
* @see SimpleElementVisitor9
* @since 1.8
*/
@SupportedSourceVersion(RELEASE_8)

View File

@ -0,0 +1,93 @@
/*
* Copyright (c) 2011, 2014, 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 static javax.lang.model.SourceVersion.*;
/**
* A simple visitor of program elements with default behavior
* appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
* source version.
*
* Visit methods corresponding to {@code RELEASE_9} 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&trade; 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
* @since 1.9
*/
@SupportedSourceVersion(RELEASE_9)
public class SimpleElementVisitor9<R, P> extends SimpleElementVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
* default value.
*/
protected SimpleElementVisitor9(){
super(null);
}
/**
* Constructor for concrete subclasses; uses the argument for the
* default value.
*
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
*/
protected SimpleElementVisitor9(R defaultValue){
super(defaultValue);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, 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
@ -85,8 +85,12 @@ import static javax.lang.model.SourceVersion.*;
*
* @see SimpleTypeVisitor7
* @see SimpleTypeVisitor8
* @see SimpleTypeVisitor9
* @since 1.6
* @deprecated Release 6 is obsolete; update to a visitor for a newer
* release level.
*/
@Deprecated
@SupportedSourceVersion(RELEASE_6)
public class SimpleTypeVisitor6<R, P> extends AbstractTypeVisitor6<R, P> {
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -78,6 +78,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see SimpleTypeVisitor6
* @see SimpleTypeVisitor8
* @see SimpleTypeVisitor9
* @since 1.7
*/
@SupportedSourceVersion(RELEASE_7)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
@ -32,7 +32,7 @@ import static javax.lang.model.SourceVersion.*;
/**
* A simple visitor of types with default behavior appropriate for the
* {@link SourceVersion#RELEASE_7 RELEASE_7} source version.
* {@link SourceVersion#RELEASE_8 RELEASE_8} source version.
*
* Visit methods corresponding to {@code RELEASE_8} and earlier
* language constructs call {@link #defaultAction defaultAction},
@ -78,6 +78,7 @@ import static javax.lang.model.SourceVersion.*;
*
* @see SimpleTypeVisitor6
* @see SimpleTypeVisitor7
* @see SimpleTypeVisitor9
* @since 1.8
*/
@SupportedSourceVersion(RELEASE_8)

View File

@ -0,0 +1,93 @@
/*
* Copyright (c) 2011, 2014, 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.type.IntersectionType;
import static javax.lang.model.SourceVersion.*;
/**
* A simple visitor of types with default behavior appropriate for the
* {@link SourceVersion#RELEASE_9 RELEASE_9} source version.
*
* Visit methods corresponding to {@code RELEASE_9} 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 TypeVisitor} 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&trade; 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 type 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 SimpleTypeVisitor6
* @see SimpleTypeVisitor7
* @since 1.8
*/
@SupportedSourceVersion(RELEASE_9)
public class SimpleTypeVisitor9<R, P> extends SimpleTypeVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
* default value.
*/
protected SimpleTypeVisitor9(){
super(null);
}
/**
* Constructor for concrete subclasses; uses the argument for the
* default value.
*
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
*/
protected SimpleTypeVisitor9(R defaultValue){
super(defaultValue);
}
}

View File

@ -85,7 +85,10 @@ import static javax.lang.model.SourceVersion.*;
* @see TypeKindVisitor7
* @see TypeKindVisitor8
* @since 1.6
* @deprecated Release 6 is obsolete; update to a visitor for a newer
* release level.
*/
@Deprecated
@SupportedSourceVersion(RELEASE_6)
public class TypeKindVisitor6<R, P> extends SimpleTypeVisitor6<R, P> {
/**

View File

@ -0,0 +1,96 @@
/*
* Copyright (c) 2011, 2014, 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.type.*;
import static javax.lang.model.SourceVersion.*;
/**
* A visitor of types based on their {@linkplain TypeKind kind} with
* default behavior appropriate for the {@link SourceVersion#RELEASE_9
* RELEASE_9} source version. For {@linkplain
* TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> 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 TypeVisitor} 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&trade; 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 type 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 TypeKindVisitor6
* @see TypeKindVisitor7
* @see TypeKindVisitor8
* @since 1.9
*/
@SupportedSourceVersion(RELEASE_9)
public class TypeKindVisitor9<R, P> extends TypeKindVisitor8<R, P> {
/**
* Constructor for concrete subclasses to call; uses {@code null}
* for the default value.
*/
protected TypeKindVisitor9() {
super(null);
}
/**
* Constructor for concrete subclasses to call; uses the argument
* for the default value.
*
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
*/
protected TypeKindVisitor9(R defaultValue) {
super(defaultValue);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -138,7 +138,7 @@ public class CheckNamesProcessor extends AbstractProcessor {
public SourceVersion getSupportedSourceVersion() {
/*
* Return latest source version instead of a fixed version
* like RELEASE_8. To return a fixed version, this class
* like RELEASE_9. To return a fixed version, this class
* could be annotated with a SupportedSourceVersion
* annotation.
*
@ -192,7 +192,7 @@ public class CheckNamesProcessor extends AbstractProcessor {
/**
* Visitor to implement name checks.
*/
private class NameCheckScanner extends ElementScanner8<Void, Void> {
private class NameCheckScanner extends ElementScanner9<Void, Void> {
// The visitor could be enhanced to return true/false if
// there were warnings reported or a count of the number
// of warnings. This could be facilitated by using

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -39,7 +39,7 @@ import java.lang.reflect.*;
import java.io.Writer;
import java.util.*;
import static javax.lang.model.SourceVersion.RELEASE_8;
import static javax.lang.model.SourceVersion.RELEASE_9;
import static java.util.Objects.*;
/**
@ -487,10 +487,10 @@ public class CoreReflectionFactory {
/**
* Base class for concrete visitors of elements backed by core reflection.
*/
public static abstract class AbstractReflectionElementVisitor8<R, P>
extends AbstractElementVisitor8<R, P>
public static abstract class AbstractReflectionElementVisitor9<R, P>
extends AbstractElementVisitor9<R, P>
implements ReflectionElementVisitor<R, P> {
protected AbstractReflectionElementVisitor8() {
protected AbstractReflectionElementVisitor9() {
super();
}
}
@ -498,16 +498,16 @@ public class CoreReflectionFactory {
/**
* Base class for simple visitors of elements that are backed by core reflection.
*/
@SupportedSourceVersion(value=RELEASE_8)
public static abstract class SimpleReflectionElementVisitor8<R, P>
extends SimpleElementVisitor8<R, P>
@SupportedSourceVersion(value=RELEASE_9)
public static abstract class SimpleReflectionElementVisitor9<R, P>
extends SimpleElementVisitor9<R, P>
implements ReflectionElementVisitor<R, P> {
protected SimpleReflectionElementVisitor8(){
protected SimpleReflectionElementVisitor9(){
super();
}
protected SimpleReflectionElementVisitor8(R defaultValue) {
protected SimpleReflectionElementVisitor9(R defaultValue) {
super(defaultValue);
}
@ -2527,7 +2527,7 @@ public class CoreReflectionFactory {
Constructor<?> printProcCtor = printProcClass.getConstructor(Writer.class, Elements.class);
return (ElementVisitor) printProcCtor.newInstance(w, getElements());
} catch (ReflectiveOperationException | SecurityException e) {
return new ElementScanner8<Writer, Void>(w){
return new ElementScanner9<Writer, Void>(w){
@Override
public Writer scan(Element e, Void v) {
try {

View File

@ -110,7 +110,7 @@ public class CheckLocalElements extends Checker {
return encl == null ? "" : encl.accept(qualNameVisitor, null);
}
private ElementVisitor<String,Void> qualNameVisitor = new SimpleElementVisitor8<String,Void>() {
private ElementVisitor<String,Void> qualNameVisitor = new SimpleElementVisitor9<String,Void>() {
protected String defaultAction(Element e, Void ignore) {
return "";
}

View File

@ -28,7 +28,7 @@ import javax.lang.model.util.*;
import static javax.lang.model.SourceVersion.*;
/**
* An abstract annotation processor tailored to javac regression testing.
* An abstract annotation processor tailored to {@code javac} regression testing.
*/
public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
private static final Set<String> allAnnotations;
@ -103,7 +103,7 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
*/
@SupportedSourceVersion(RELEASE_9)
public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor8<R, P> {
public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
@ -114,7 +114,7 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
}
@SupportedSourceVersion(RELEASE_9)
public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor8<R, P> {
public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
*/
@ -124,7 +124,7 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
}
@SupportedSourceVersion(RELEASE_9)
public static abstract class AbstractTypeVisitor<R, P> extends AbstractTypeVisitor8<R, P> {
public static abstract class AbstractTypeVisitor<R, P> extends AbstractTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
*/
@ -134,7 +134,7 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
}
@SupportedSourceVersion(RELEASE_9)
public static class ElementKindVisitor<R, P> extends ElementKindVisitor8<R, P> {
public static class ElementKindVisitor<R, P> extends ElementKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
* default value.
@ -155,7 +155,7 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
}
@SupportedSourceVersion(RELEASE_9)
public static class ElementScanner<R, P> extends ElementScanner8<R, P> {
public static class ElementScanner<R, P> extends ElementScanner9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
* default value.
@ -174,7 +174,7 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
}
@SupportedSourceVersion(RELEASE_9)
public static class SimpleAnnotationValueVisitor<R, P> extends SimpleAnnotationValueVisitor8<R, P> {
public static class SimpleAnnotationValueVisitor<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
* default value.
@ -195,7 +195,7 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
}
@SupportedSourceVersion(RELEASE_9)
public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor8<R, P> {
public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
* default value.
@ -216,7 +216,7 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
}
@SupportedSourceVersion(RELEASE_9)
public static class SimpleTypeVisitor<R, P> extends SimpleTypeVisitor8<R, P> {
public static class SimpleTypeVisitor<R, P> extends SimpleTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
* default value.
@ -237,7 +237,7 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
}
@SupportedSourceVersion(RELEASE_9)
public static class TypeKindVisitor<R, P> extends TypeKindVisitor8<R, P> {
public static class TypeKindVisitor<R, P> extends TypeKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call; uses {@code null}
* for the default value.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -46,7 +46,6 @@ import javax.lang.model.type.TypeKind;
import javax.lang.model.type.UnionType;
import javax.lang.model.type.UnknownTypeException;
import javax.lang.model.util.SimpleTypeVisitor6;
import javax.lang.model.util.SimpleTypeVisitor7;
@SupportedAnnotationTypes("Check")
public class ModelChecker extends JavacTestingAbstractProcessor {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
@ -110,7 +110,7 @@ public class TestSymtabItems {
int errors;
class ElemPrinter extends ElementScanner8<Void, Void> {
class ElemPrinter extends ElementScanner9<Void, Void> {
@Override
public Void visitPackage(PackageElement e, Void p) {
show("package", e);
@ -201,7 +201,7 @@ public class TestSymtabItems {
int indent;
};
class TypePrinter extends SimpleTypeVisitor7<Void, Types> {
class TypePrinter extends SimpleTypeVisitor9<Void, Types> {
@Override
public Void defaultAction(TypeMirror m, Types types) {
System.err.println(m.getKind() + " " + m + " " + types.asElement(m));

View File

@ -53,7 +53,7 @@ public class TestTypeParameter<T> extends JavacTestingAbstractProcessor {
return true;
}
class Scanner extends ElementScanner7<Integer,Void> {
class Scanner extends ElementScanner<Integer, Void> {
@Override
public Integer visitExecutable(ExecutableElement e, Void p) {
super.visitExecutable(e, p);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2014, 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
@ -25,7 +25,7 @@
* @test
* @bug 8024513
* @library /tools/javac/lib
* @build InheritedAP
* @build JavacTestingAbstractProcessor InheritedAP
* @compile -cp . -processor InheritedAP -proc:only InheritedAP.java
* @summary NPE in annotation processing
*/
@ -40,8 +40,7 @@ import static javax.lang.model.SourceVersion.*;
import static javax.lang.model.util.ElementFilter.*;
@SupportedAnnotationTypes("testclass")
@SupportedSourceVersion(RELEASE_8)
public class InheritedAP extends AbstractProcessor {
public class InheritedAP extends JavacTestingAbstractProcessor {
static Types types;
public void init(ProcessingEnvironment penv) {super.init(penv);}
public static Types getTypes() { return types; }
@ -54,14 +53,14 @@ public class InheritedAP extends AbstractProcessor {
types=processingEnv.getTypeUtils();
for (TypeElement typeElem: typesIn(renv.getRootElements())) {
if (typeElem.getAnnotation(testclass.class) != null) {
new ElementScanner( new SimpleTypeMirrorVisitor()).scan(typeElem, null);
new LocalElementScanner( new SimpleTypeMirrorVisitor()).scan(typeElem, null);
}
}
return true ;
}
}
class SimpleTypeMirrorVisitor extends SimpleTypeVisitor6 <Void, Void> {
class SimpleTypeMirrorVisitor extends JavacTestingAbstractProcessor.SimpleTypeVisitor<Void, Void> {
protected Void defaultAction(TypeMirror mirror, Void p ) {
try {
System.out.println( "InheritedAP.getTypes().directSupertypes( "+mirror.toString()+" );" );
@ -72,11 +71,11 @@ class SimpleTypeMirrorVisitor extends SimpleTypeVisitor6 <Void, Void> {
}
}
class ElementScanner <T extends SimpleTypeVisitor6<Void, Void> >
extends ElementScanner6<Void, Void> {
SimpleTypeVisitor6<Void, Void> typeVisitor;
class LocalElementScanner <T extends JavacTestingAbstractProcessor.SimpleTypeVisitor<Void, Void> >
extends JavacTestingAbstractProcessor.ElementScanner<Void, Void> {
JavacTestingAbstractProcessor.SimpleTypeVisitor<Void, Void> typeVisitor;
public ElementScanner(T typeVisitor) { this.typeVisitor=typeVisitor;}
public LocalElementScanner(T typeVisitor) { this.typeVisitor=typeVisitor;}
@Override
public Void scan(Element e, Void p) {
@ -86,7 +85,6 @@ class ElementScanner <T extends SimpleTypeVisitor6<Void, Void> >
}
return p;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2014, 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
@ -25,6 +25,9 @@
* @test
* @bug 6877202 6986246
* @summary Elements.getDocComment() is not getting JavaDocComments
* @library /tools/javac/lib
* @build JavacTestingAbstractProcessor TestDocComments
* @run main TestDocComments
*/
import com.sun.source.tree.*;
@ -49,8 +52,7 @@ import javax.tools.*;
*/
@SupportedOptions("scan")
@SupportedAnnotationTypes("*")
public class TestDocComments extends AbstractProcessor {
public class TestDocComments extends JavacTestingAbstractProcessor {
enum CompileKind { API, CMD };
enum ScanKind { TREE, ELEMENT };
@ -72,7 +74,7 @@ public class TestDocComments extends AbstractProcessor {
}
static void test(CompileKind ck, ScanKind sk) throws IOException {
String testClasses = System.getProperty("test.classes");
String testClasses = System.getProperty("test.class.path");
String testSrc = System.getProperty("test.src");
File testDir = new File("test." + ck + "." + sk);
testDir.mkdirs();
@ -136,26 +138,15 @@ public class TestDocComments extends AbstractProcessor {
// ----- Annotation processor: scan for elements and check doc comments ----
Map<String,String> options;
Filer filer;
Messager messager;
Elements elements;
Trees trees;
ScanKind skind;
int round = 0;
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latest();
}
@Override
public void init(ProcessingEnvironment pEnv) {
super.init(pEnv);
options = pEnv.getOptions();
filer = pEnv.getFiler();
messager = pEnv.getMessager();
elements = pEnv.getElementUtils();
trees = Trees.instance(processingEnv);
skind = ScanKind.valueOf(options.get("scan"));
}
@ -271,7 +262,7 @@ public class TestDocComments extends AbstractProcessor {
// ----- Scanners to find elements -----------------------------------------
class TestElementScanner extends ElementScanner7<Void, Void> {
class TestElementScanner extends ElementScanner<Void, Void> {
@Override
public Void visitExecutable(ExecutableElement e, Void _) {
check(e);
@ -306,5 +297,4 @@ public class TestDocComments extends AbstractProcessor {
return super.visitVariable(tree, trees);
}
}
}

View File

@ -25,8 +25,10 @@
* @test
* @bug 8042345
* @summary getDocComment() fails for doc comments on PackageElement found in package-info.java
* @library /tools/javac/lib
* @build JavacTestingAbstractProcessor TestPackageInfoComments
* @run main TestPackageInfoComments
*/
import com.sun.source.util.JavacTask;
import java.io.*;
@ -37,14 +39,13 @@ import javax.lang.model.element.*;
import javax.lang.model.util.*;
import javax.tools.*;
@SupportedAnnotationTypes("*")
public class TestPackageInfoComments extends AbstractProcessor {
public class TestPackageInfoComments extends JavacTestingAbstractProcessor {
public static void main(String... args) throws Exception {
String[] opts = {
"-implicit:none",
"-processor", TestPackageInfoComments.class.getName(),
"-processorpath", System.getProperty("test.classes")
"-processorpath", System.getProperty("test.class.path")
};
File[] files = {
new File(System.getProperty("test.src"), "p/package-info.java")
@ -68,21 +69,6 @@ public class TestPackageInfoComments extends AbstractProcessor {
// -- Annotation processor: Check all PackageDecl's have a doc comment
Messager messager;
Elements elements;
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latest();
}
@Override
public void init(ProcessingEnvironment pEnv) {
super.init(pEnv);
messager = pEnv.getMessager();
elements = pEnv.getElementUtils();
}
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (Element e: roundEnv.getRootElements())
@ -90,7 +76,7 @@ public class TestPackageInfoComments extends AbstractProcessor {
return true;
}
class TestElementScanner extends ElementScanner7<Void, Void> {
class TestElementScanner extends ElementScanner<Void, Void> {
@Override
public Void visitPackage(PackageElement e, Void v) {
if (elements.getDocComment(e) == null)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2014, 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
@ -51,8 +51,6 @@ import javax.lang.model.type.IntersectionType;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVariable;
import javax.lang.model.type.WildcardType;
import javax.lang.model.util.ElementScanner8;
import javax.lang.model.util.SimpleAnnotationValueVisitor8;
import javax.tools.Diagnostic.Kind;
public class NoPrivateTypesExported extends JavacTestingAbstractProcessor {
@ -131,7 +129,7 @@ public class NoPrivateTypesExported extends JavacTestingAbstractProcessor {
private void verifyReferredTypesAcceptable(Element rootElement,
final Set<String> acceptable) {
new ElementScanner8<Void, Void>() {
new ElementScanner<Void, Void>() {
@Override public Void visitType(TypeElement e, Void p) {
verifyTypeAcceptable(e.getSuperclass(), acceptable);
verifyTypesAcceptable(e.getInterfaces(), acceptable);
@ -189,7 +187,7 @@ public class NoPrivateTypesExported extends JavacTestingAbstractProcessor {
private void verifyAnnotationValue(AnnotationValue value,
final Set<String> acceptable) {
value.accept(new SimpleAnnotationValueVisitor8<Void, Void>() {
value.accept(new SimpleAnnotationValueVisitor<Void, Void>() {
@Override public Void visitType(TypeMirror t, Void p) {
verifyTypeAcceptable(t, acceptable);
return null;