mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
Merge
This commit is contained in:
commit
a6cbb46a23
65 changed files with 1237 additions and 134 deletions
|
@ -158,10 +158,10 @@ public class JavacTaskImpl extends JavacTask {
|
|||
} else {
|
||||
initContext();
|
||||
compilerMain.setOptions(Options.instance(context));
|
||||
compilerMain.filenames = new ListBuffer<File>();
|
||||
List<File> filenames = compilerMain.processArgs(CommandLine.parse(args));
|
||||
compilerMain.filenames = new LinkedHashSet<File>();
|
||||
Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args));
|
||||
if (!filenames.isEmpty())
|
||||
throw new IllegalArgumentException("Malformed arguments " + filenames.toString(" "));
|
||||
throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
|
||||
compiler = JavaCompiler.instance(context);
|
||||
compiler.keepComments = true;
|
||||
compiler.genEndPos = true;
|
||||
|
@ -177,6 +177,17 @@ public class JavacTaskImpl extends JavacTask {
|
|||
}
|
||||
}
|
||||
|
||||
<T> String toString(Iterable<T> items, String sep) {
|
||||
String currSep = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (T item: items) {
|
||||
sb.append(currSep);
|
||||
sb.append(item.toString());
|
||||
currSep = sep;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void initContext() {
|
||||
context.put(JavacTaskImpl.class, this);
|
||||
if (context.get(TaskListener.class) != null)
|
||||
|
|
|
@ -31,7 +31,10 @@ import java.io.PrintWriter;
|
|||
import java.net.URL;
|
||||
import java.security.DigestInputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Set;
|
||||
import javax.tools.JavaFileManager;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.annotation.processing.Processor;
|
||||
|
@ -107,8 +110,7 @@ public class Main {
|
|||
}
|
||||
|
||||
public void addFile(File f) {
|
||||
if (!filenames.contains(f))
|
||||
filenames.append(f);
|
||||
filenames.add(f);
|
||||
}
|
||||
|
||||
public void addClassName(String s) {
|
||||
|
@ -136,7 +138,7 @@ public class Main {
|
|||
|
||||
/** The list of source files to process
|
||||
*/
|
||||
public ListBuffer<File> filenames = null; // XXX sb protected
|
||||
public Set<File> filenames = null; // XXX sb protected
|
||||
|
||||
/** List of class files names passed on the command line
|
||||
*/
|
||||
|
@ -202,7 +204,7 @@ public class Main {
|
|||
* in `options' table and return all source filenames.
|
||||
* @param flags The array of command line arguments.
|
||||
*/
|
||||
public List<File> processArgs(String[] flags) { // XXX sb protected
|
||||
public Collection<File> processArgs(String[] flags) { // XXX sb protected
|
||||
int ac = 0;
|
||||
while (ac < flags.length) {
|
||||
String flag = flags[ac];
|
||||
|
@ -294,7 +296,7 @@ public class Main {
|
|||
showClass(showClass);
|
||||
}
|
||||
|
||||
return filenames.toList();
|
||||
return filenames;
|
||||
}
|
||||
// where
|
||||
private boolean checkDirectory(OptionName optName) {
|
||||
|
@ -342,7 +344,7 @@ public class Main {
|
|||
if (options == null)
|
||||
options = Options.instance(context); // creates a new one
|
||||
|
||||
filenames = new ListBuffer<File>();
|
||||
filenames = new LinkedHashSet<File>();
|
||||
classnames = new ListBuffer<String>();
|
||||
JavaCompiler comp = null;
|
||||
/*
|
||||
|
@ -356,7 +358,7 @@ public class Main {
|
|||
return EXIT_CMDERR;
|
||||
}
|
||||
|
||||
List<File> files;
|
||||
Collection<File> files;
|
||||
try {
|
||||
files = processArgs(CommandLine.parse(args));
|
||||
if (files == null) {
|
||||
|
|
|
@ -720,7 +720,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
|||
* Leave class public for external testing purposes.
|
||||
*/
|
||||
public static class ComputeAnnotationSet extends
|
||||
ElementScanner7<Set<TypeElement>, Set<TypeElement>> {
|
||||
ElementScanner8<Set<TypeElement>, Set<TypeElement>> {
|
||||
final Elements elements;
|
||||
|
||||
public ComputeAnnotationSet(Elements elements) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, 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
|
||||
|
@ -125,7 +125,7 @@ public class JavacRoundEnvironment implements RoundEnvironment {
|
|||
else
|
||||
throw new AssertionError("Bad implementation type for " + tm);
|
||||
|
||||
ElementScanner7<Set<Element>, DeclaredType> scanner =
|
||||
ElementScanner8<Set<Element>, DeclaredType> scanner =
|
||||
new AnnotationSetScanner(result, typeUtil);
|
||||
|
||||
for (Element element : rootElements)
|
||||
|
@ -136,7 +136,7 @@ public class JavacRoundEnvironment implements RoundEnvironment {
|
|||
|
||||
// Could be written as a local class inside getElementsAnnotatedWith
|
||||
private class AnnotationSetScanner extends
|
||||
ElementScanner7<Set<Element>, DeclaredType> {
|
||||
ElementScanner8<Set<Element>, DeclaredType> {
|
||||
// Insertion-order preserving set
|
||||
Set<Element> annotatedElements = new LinkedHashSet<Element>();
|
||||
Types typeUtil;
|
||||
|
|
|
@ -82,7 +82,7 @@ public class PrintingProcessor extends AbstractProcessor {
|
|||
* Used for the -Xprint option and called by Elements.printElements
|
||||
*/
|
||||
public static class PrintingElementVisitor
|
||||
extends SimpleElementVisitor7<PrintingElementVisitor, Boolean> {
|
||||
extends SimpleElementVisitor8<PrintingElementVisitor, Boolean> {
|
||||
int indentation; // Indentation level;
|
||||
final PrintWriter writer;
|
||||
final Elements elementUtils;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, 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,11 +46,11 @@ import com.sun.tools.javac.util.Position;
|
|||
public class AnnotationTypeDocImpl
|
||||
extends ClassDocImpl implements AnnotationTypeDoc {
|
||||
|
||||
AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym) {
|
||||
public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym) {
|
||||
this(env, sym, null, null, null);
|
||||
}
|
||||
|
||||
AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym,
|
||||
public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym,
|
||||
String doc, JCClassDecl tree, Position.LineMap lineMap) {
|
||||
super(env, sym, doc, tree, lineMap);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, 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,11 +45,11 @@ import com.sun.tools.javac.util.Position;
|
|||
public class AnnotationTypeElementDocImpl
|
||||
extends MethodDocImpl implements AnnotationTypeElementDoc {
|
||||
|
||||
AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym) {
|
||||
public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym) {
|
||||
super(env, sym);
|
||||
}
|
||||
|
||||
AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym,
|
||||
public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym,
|
||||
String doc, JCMethodDecl tree, Position.LineMap lineMap) {
|
||||
super(env, sym, doc, tree, lineMap);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, 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
|
||||
|
@ -84,7 +84,7 @@ public class DocEnv {
|
|||
final Symbol externalizableSym;
|
||||
|
||||
/** Access filter (public, protected, ...). */
|
||||
ModifierFilter showAccess;
|
||||
protected ModifierFilter showAccess;
|
||||
|
||||
/** True if we are using a sentence BreakIterator. */
|
||||
boolean breakiterator;
|
||||
|
@ -102,7 +102,7 @@ public class DocEnv {
|
|||
boolean docClasses = false;
|
||||
|
||||
/** Does the doclet only expect pre-1.5 doclet API? */
|
||||
boolean legacyDoclet = true;
|
||||
protected boolean legacyDoclet = true;
|
||||
|
||||
/**
|
||||
* Set this to true if you would like to not emit any errors, warnings and
|
||||
|
@ -115,7 +115,7 @@ public class DocEnv {
|
|||
*
|
||||
* @param context Context for this javadoc instance.
|
||||
*/
|
||||
private DocEnv(Context context) {
|
||||
protected DocEnv(Context context) {
|
||||
context.put(docEnvKey, this);
|
||||
|
||||
messager = Messager.instance0(context);
|
||||
|
@ -517,7 +517,7 @@ public class DocEnv {
|
|||
messager.exit();
|
||||
}
|
||||
|
||||
private Map<PackageSymbol, PackageDocImpl> packageMap =
|
||||
protected Map<PackageSymbol, PackageDocImpl> packageMap =
|
||||
new HashMap<PackageSymbol, PackageDocImpl>();
|
||||
/**
|
||||
* Return the PackageDoc of this package symbol.
|
||||
|
@ -545,12 +545,12 @@ public class DocEnv {
|
|||
}
|
||||
|
||||
|
||||
private Map<ClassSymbol, ClassDocImpl> classMap =
|
||||
protected Map<ClassSymbol, ClassDocImpl> classMap =
|
||||
new HashMap<ClassSymbol, ClassDocImpl>();
|
||||
/**
|
||||
* Return the ClassDoc (or a subtype) of this class symbol.
|
||||
*/
|
||||
ClassDocImpl getClassDoc(ClassSymbol clazz) {
|
||||
public ClassDocImpl getClassDoc(ClassSymbol clazz) {
|
||||
ClassDocImpl result = classMap.get(clazz);
|
||||
if (result != null) return result;
|
||||
if (isAnnotationType(clazz)) {
|
||||
|
@ -565,7 +565,7 @@ public class DocEnv {
|
|||
/**
|
||||
* Create the ClassDoc (or a subtype) for a class symbol.
|
||||
*/
|
||||
void makeClassDoc(ClassSymbol clazz, String docComment, JCClassDecl tree, Position.LineMap lineMap) {
|
||||
protected void makeClassDoc(ClassSymbol clazz, String docComment, JCClassDecl tree, Position.LineMap lineMap) {
|
||||
ClassDocImpl result = classMap.get(clazz);
|
||||
if (result != null) {
|
||||
if (docComment != null) result.setRawCommentText(docComment);
|
||||
|
@ -580,20 +580,20 @@ public class DocEnv {
|
|||
classMap.put(clazz, result);
|
||||
}
|
||||
|
||||
private static boolean isAnnotationType(ClassSymbol clazz) {
|
||||
protected static boolean isAnnotationType(ClassSymbol clazz) {
|
||||
return ClassDocImpl.isAnnotationType(clazz);
|
||||
}
|
||||
|
||||
private static boolean isAnnotationType(JCClassDecl tree) {
|
||||
protected static boolean isAnnotationType(JCClassDecl tree) {
|
||||
return (tree.mods.flags & Flags.ANNOTATION) != 0;
|
||||
}
|
||||
|
||||
private Map<VarSymbol, FieldDocImpl> fieldMap =
|
||||
protected Map<VarSymbol, FieldDocImpl> fieldMap =
|
||||
new HashMap<VarSymbol, FieldDocImpl>();
|
||||
/**
|
||||
* Return the FieldDoc of this var symbol.
|
||||
*/
|
||||
FieldDocImpl getFieldDoc(VarSymbol var) {
|
||||
public FieldDocImpl getFieldDoc(VarSymbol var) {
|
||||
FieldDocImpl result = fieldMap.get(var);
|
||||
if (result != null) return result;
|
||||
result = new FieldDocImpl(this, var);
|
||||
|
@ -603,7 +603,7 @@ public class DocEnv {
|
|||
/**
|
||||
* Create a FieldDoc for a var symbol.
|
||||
*/
|
||||
void makeFieldDoc(VarSymbol var, String docComment, JCVariableDecl tree, Position.LineMap lineMap) {
|
||||
protected void makeFieldDoc(VarSymbol var, String docComment, JCVariableDecl tree, Position.LineMap lineMap) {
|
||||
FieldDocImpl result = fieldMap.get(var);
|
||||
if (result != null) {
|
||||
if (docComment != null) result.setRawCommentText(docComment);
|
||||
|
@ -614,13 +614,13 @@ public class DocEnv {
|
|||
}
|
||||
}
|
||||
|
||||
private Map<MethodSymbol, ExecutableMemberDocImpl> methodMap =
|
||||
protected Map<MethodSymbol, ExecutableMemberDocImpl> methodMap =
|
||||
new HashMap<MethodSymbol, ExecutableMemberDocImpl>();
|
||||
/**
|
||||
* Create a MethodDoc for this MethodSymbol.
|
||||
* Should be called only on symbols representing methods.
|
||||
*/
|
||||
void makeMethodDoc(MethodSymbol meth, String docComment,
|
||||
protected void makeMethodDoc(MethodSymbol meth, String docComment,
|
||||
JCMethodDecl tree, Position.LineMap lineMap) {
|
||||
MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
|
||||
if (result != null) {
|
||||
|
@ -649,7 +649,7 @@ public class DocEnv {
|
|||
* Create the ConstructorDoc for a MethodSymbol.
|
||||
* Should be called only on symbols representing constructors.
|
||||
*/
|
||||
void makeConstructorDoc(MethodSymbol meth, String docComment,
|
||||
protected void makeConstructorDoc(MethodSymbol meth, String docComment,
|
||||
JCMethodDecl tree, Position.LineMap lineMap) {
|
||||
ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
|
||||
if (result != null) {
|
||||
|
@ -678,7 +678,7 @@ public class DocEnv {
|
|||
* Create the AnnotationTypeElementDoc for a MethodSymbol.
|
||||
* Should be called only on symbols representing annotation type elements.
|
||||
*/
|
||||
void makeAnnotationTypeElementDoc(MethodSymbol meth,
|
||||
protected void makeAnnotationTypeElementDoc(MethodSymbol meth,
|
||||
String docComment, JCMethodDecl tree, Position.LineMap lineMap) {
|
||||
AnnotationTypeElementDocImpl result =
|
||||
(AnnotationTypeElementDocImpl)methodMap.get(meth);
|
||||
|
|
|
@ -92,7 +92,7 @@ public abstract class DocImpl implements Doc, Comparable<Object> {
|
|||
* So subclasses have the option to do lazy initialization of
|
||||
* "documentation" string.
|
||||
*/
|
||||
String documentation() {
|
||||
protected String documentation() {
|
||||
if (documentation == null) documentation = "";
|
||||
return documentation;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import com.sun.tools.javac.util.Context;
|
|||
/** Javadoc uses an extended class reader that records package.html entries
|
||||
* @author Neal Gafter
|
||||
*/
|
||||
class JavadocClassReader extends ClassReader {
|
||||
public class JavadocClassReader extends ClassReader {
|
||||
|
||||
public static JavadocClassReader instance0(Context context) {
|
||||
ClassReader instance = context.get(classReaderKey);
|
||||
|
@ -59,7 +59,7 @@ class JavadocClassReader extends ClassReader {
|
|||
private EnumSet<JavaFileObject.Kind> noSource = EnumSet.of(JavaFileObject.Kind.CLASS,
|
||||
JavaFileObject.Kind.HTML);
|
||||
|
||||
private JavadocClassReader(Context context) {
|
||||
public JavadocClassReader(Context context) {
|
||||
super(context, true);
|
||||
docenv = DocEnv.instance(context);
|
||||
preferSource = true;
|
||||
|
|
|
@ -38,7 +38,7 @@ import com.sun.tools.javac.tree.JCTree.*;
|
|||
* done by javac.
|
||||
* @author Neal Gafter
|
||||
*/
|
||||
class JavadocMemberEnter extends MemberEnter {
|
||||
public class JavadocMemberEnter extends MemberEnter {
|
||||
public static JavadocMemberEnter instance0(Context context) {
|
||||
MemberEnter instance = context.get(memberEnterKey);
|
||||
if (instance == null)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, 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
|
||||
|
@ -96,7 +96,7 @@ public class PackageDocImpl extends DocImpl implements PackageDoc {
|
|||
/**
|
||||
* Do lazy initialization of "documentation" string.
|
||||
*/
|
||||
String documentation() {
|
||||
protected String documentation() {
|
||||
if (documentation != null)
|
||||
return documentation;
|
||||
if (docPath != null) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, 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
|
||||
|
@ -44,6 +44,11 @@ class ParamTagImpl extends TagImpl implements ParamTag {
|
|||
private final String parameterComment;
|
||||
private final boolean isTypeParameter;
|
||||
|
||||
/**
|
||||
* Cached inline tags.
|
||||
*/
|
||||
private Tag[] inlineTags;
|
||||
|
||||
ParamTagImpl(DocImpl holder, String name, String text) {
|
||||
super(holder, name, text);
|
||||
String[] sa = divideAtWhite();
|
||||
|
@ -71,6 +76,7 @@ class ParamTagImpl extends TagImpl implements ParamTag {
|
|||
/**
|
||||
* Return the kind of this tag.
|
||||
*/
|
||||
@Override
|
||||
public String kind() {
|
||||
return "@param";
|
||||
}
|
||||
|
@ -85,6 +91,7 @@ class ParamTagImpl extends TagImpl implements ParamTag {
|
|||
/**
|
||||
* convert this object to a string.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return name + ":" + text;
|
||||
}
|
||||
|
@ -97,7 +104,11 @@ class ParamTagImpl extends TagImpl implements ParamTag {
|
|||
* @see TagImpl#inlineTagImpls()
|
||||
* @see ThrowsTagImpl#inlineTagImpls()
|
||||
*/
|
||||
@Override
|
||||
public Tag[] inlineTags() {
|
||||
return Comment.getInlineTags(holder, parameterComment);
|
||||
if (inlineTags == null) {
|
||||
inlineTags = Comment.getInlineTags(holder, parameterComment);
|
||||
}
|
||||
return inlineTags;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, 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
|
||||
|
@ -80,6 +80,9 @@ class SerialFieldTagImpl
|
|||
*/
|
||||
private void parseSerialFieldString() {
|
||||
int len = text.length();
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if no white space found
|
||||
/* Skip white space. */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, 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
|
||||
|
@ -43,6 +43,11 @@ class ThrowsTagImpl extends TagImpl implements ThrowsTag {
|
|||
private final String exceptionName;
|
||||
private final String exceptionComment;
|
||||
|
||||
/**
|
||||
* Cached inline tags.
|
||||
*/
|
||||
private Tag[] inlineTags;
|
||||
|
||||
ThrowsTagImpl(DocImpl holder, String name, String text) {
|
||||
super(holder, name, text);
|
||||
String[] sa = divideAtWhite();
|
||||
|
@ -93,6 +98,7 @@ class ThrowsTagImpl extends TagImpl implements ThrowsTag {
|
|||
* Return the kind of this tag. Always "@throws" for instances
|
||||
* of ThrowsTagImpl.
|
||||
*/
|
||||
@Override
|
||||
public String kind() {
|
||||
return "@throws";
|
||||
}
|
||||
|
@ -105,7 +111,11 @@ class ThrowsTagImpl extends TagImpl implements ThrowsTag {
|
|||
* @see TagImpl#inlineTagImpls()
|
||||
* @see ParamTagImpl#inlineTagImpls()
|
||||
*/
|
||||
@Override
|
||||
public Tag[] inlineTags() {
|
||||
return Comment.getInlineTags(holder, exceptionComment());
|
||||
if (inlineTags == null) {
|
||||
inlineTags = Comment.getInlineTags(holder, exceptionComment());
|
||||
}
|
||||
return inlineTags;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, 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.SimpleTypeVisitor7;
|
||||
import javax.lang.model.util.SimpleTypeVisitor8;
|
||||
import javax.lang.model.util.Types;
|
||||
|
||||
import javax.tools.Diagnostic;
|
||||
|
@ -753,7 +753,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
|
|||
}
|
||||
|
||||
private TypeVisitor<Void,Types> checkMethodParametersVisitor =
|
||||
new SimpleTypeVisitor7<Void,Types>() {
|
||||
new SimpleTypeVisitor8<Void,Types>() {
|
||||
@Override
|
||||
public Void visitArray(ArrayType t, Types types) {
|
||||
visit(t.getComponentType(), types);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, 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.SimpleTypeVisitor7;
|
||||
import javax.lang.model.util.SimpleTypeVisitor8;
|
||||
|
||||
/*
|
||||
* <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 SimpleTypeVisitor7<Boolean,Void>() {
|
||||
TypeVisitor<Boolean,Void> v = new SimpleTypeVisitor8<Boolean,Void>() {
|
||||
public Boolean defaultAction(TypeMirror t, Void p){
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, 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.SimpleTypeVisitor7;
|
||||
import javax.lang.model.util.SimpleTypeVisitor8;
|
||||
|
||||
/**
|
||||
* Returns internal type signature.
|
||||
|
@ -245,7 +245,7 @@ public class TypeSignature {
|
|||
|
||||
|
||||
String qualifiedTypeName(TypeMirror type) {
|
||||
TypeVisitor<Name, Void> v = new SimpleTypeVisitor7<Name, Void>() {
|
||||
TypeVisitor<Name, Void> v = new SimpleTypeVisitor8<Name, Void>() {
|
||||
@Override
|
||||
public Name visitArray(ArrayType t, Void p) {
|
||||
return t.getComponentType().accept(this, p);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, 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
|
||||
|
@ -64,6 +64,7 @@ import javax.annotation.processing.SupportedSourceVersion;
|
|||
* @author Peter von der Ahé
|
||||
*
|
||||
* @see AbstractAnnotationValueVisitor7
|
||||
* @see AbstractAnnotationValueVisitor8
|
||||
* @since 1.6
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_6)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2011 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
|
||||
|
@ -59,6 +59,7 @@ import javax.annotation.processing.SupportedSourceVersion;
|
|||
* @param <P> the type of the additional parameter to this visitor's methods.
|
||||
*
|
||||
* @see AbstractAnnotationValueVisitor6
|
||||
* @see AbstractAnnotationValueVisitor8
|
||||
* @since 1.7
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_7)
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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 java.util.List;
|
||||
import javax.lang.model.element.*;
|
||||
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
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_8 RELEASE_8}
|
||||
* 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™ 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
|
||||
* @since 1.8
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public abstract class AbstractAnnotationValueVisitor8<R, P> extends AbstractAnnotationValueVisitor7<R, P> {
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses to call.
|
||||
*/
|
||||
protected AbstractAnnotationValueVisitor8() {
|
||||
super();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, 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
|
||||
|
@ -67,6 +67,7 @@ import javax.lang.model.SourceVersion;
|
|||
* @author Peter von der Ahé
|
||||
*
|
||||
* @see AbstractElementVisitor7
|
||||
* @see AbstractElementVisitor8
|
||||
* @since 1.6
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_6)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2011, 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
|
||||
|
@ -62,6 +62,7 @@ import javax.lang.model.SourceVersion;
|
|||
* additional parameter.
|
||||
*
|
||||
* @see AbstractElementVisitor6
|
||||
* @see AbstractElementVisitor8
|
||||
* @since 1.7
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_7)
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.element.*;
|
||||
import static javax.lang.model.element.ElementKind.*;
|
||||
import static javax.lang.model.SourceVersion.*;
|
||||
import javax.lang.model.SourceVersion;
|
||||
|
||||
|
||||
/**
|
||||
* A skeletal visitor of program elements with default behavior
|
||||
* appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
|
||||
* 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
|
||||
* @since 1.8
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public abstract class AbstractElementVisitor8<R, P> extends AbstractElementVisitor7<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses to call.
|
||||
*/
|
||||
protected AbstractElementVisitor8(){
|
||||
super();
|
||||
}
|
||||
}
|
|
@ -60,6 +60,7 @@ import javax.lang.model.type.*;
|
|||
* @author Peter von der Ahé
|
||||
*
|
||||
* @see AbstractTypeVisitor7
|
||||
* @see AbstractTypeVisitor8
|
||||
* @since 1.6
|
||||
*/
|
||||
public abstract class AbstractTypeVisitor6<R, P> implements TypeVisitor<R, P> {
|
||||
|
|
|
@ -56,6 +56,7 @@ import javax.lang.model.type.*;
|
|||
* additional parameter.
|
||||
*
|
||||
* @see AbstractTypeVisitor6
|
||||
* @see AbstractTypeVisitor8
|
||||
* @since 1.7
|
||||
*/
|
||||
public abstract class AbstractTypeVisitor7<R, P> extends AbstractTypeVisitor6<R, P> {
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) 2011 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.type.*;
|
||||
|
||||
/**
|
||||
* A skeletal visitor of types with default behavior appropriate for
|
||||
* the {@link javax.lang.model.SourceVersion#RELEASE_8 RELEASE_8}
|
||||
* 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™ 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
|
||||
* @since 1.8
|
||||
*/
|
||||
public abstract class AbstractTypeVisitor8<R, P> extends AbstractTypeVisitor7<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses to call.
|
||||
*/
|
||||
protected AbstractTypeVisitor8() {
|
||||
super();
|
||||
}
|
||||
}
|
|
@ -78,6 +78,7 @@ import javax.lang.model.SourceVersion;
|
|||
* @author Peter von der Ahé
|
||||
*
|
||||
* @see ElementKindVisitor7
|
||||
* @see ElementKindVisitor8
|
||||
* @since 1.6
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_6)
|
||||
|
|
|
@ -73,6 +73,7 @@ import javax.lang.model.SourceVersion;
|
|||
* additional parameter.
|
||||
*
|
||||
* @see ElementKindVisitor6
|
||||
* @see ElementKindVisitor8
|
||||
* @since 1.7
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_7)
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (c) 2011 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 static javax.lang.model.element.ElementKind.*;
|
||||
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_8 RELEASE_8} 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™ 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
|
||||
* @since 1.8
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public class ElementKindVisitor8<R, P> extends ElementKindVisitor7<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses {@code null} for the
|
||||
* default value.
|
||||
*/
|
||||
protected ElementKindVisitor8() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses the argument for the
|
||||
* default value.
|
||||
*
|
||||
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
|
||||
*/
|
||||
protected ElementKindVisitor8(R defaultValue) {
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
|
@ -90,6 +90,7 @@ import static javax.lang.model.SourceVersion.*;
|
|||
* @author Peter von der Ahé
|
||||
*
|
||||
* @see ElementScanner7
|
||||
* @see ElementScanner8
|
||||
* @since 1.6
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_6)
|
||||
|
|
|
@ -86,6 +86,7 @@ import static javax.lang.model.SourceVersion.*;
|
|||
* additional parameter.
|
||||
*
|
||||
* @see ElementScanner6
|
||||
* @see ElementScanner8
|
||||
* @since 1.7
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_7)
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.element.ElementKind.*;
|
||||
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_8 RELEASE_8}
|
||||
* 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™ 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
|
||||
* @since 1.8
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public class ElementScanner8<R, P> extends ElementScanner7<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses {@code null} for the
|
||||
* default value.
|
||||
*/
|
||||
protected ElementScanner8(){
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses the argument for the
|
||||
* default value.
|
||||
*/
|
||||
protected ElementScanner8(R defaultValue){
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, 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
|
||||
|
@ -71,6 +71,7 @@ import javax.annotation.processing.SupportedSourceVersion;
|
|||
* @author Peter von der Ahé
|
||||
*
|
||||
* @see SimpleAnnotationValueVisitor7
|
||||
* @see SimpleAnnotationValueVisitor8
|
||||
* @since 1.6
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_6)
|
||||
|
|
|
@ -66,6 +66,7 @@ import javax.annotation.processing.SupportedSourceVersion;
|
|||
* @param <P> the type of the additional parameter to this visitor's methods.
|
||||
*
|
||||
* @see SimpleAnnotationValueVisitor6
|
||||
* @see SimpleAnnotationValueVisitor8
|
||||
* @since 1.7
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_7)
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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 java.util.List;
|
||||
import javax.lang.model.element.*;
|
||||
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import static javax.lang.model.SourceVersion.*;
|
||||
import javax.lang.model.SourceVersion;
|
||||
import javax.annotation.processing.SupportedSourceVersion;
|
||||
|
||||
/**
|
||||
* A simple visitor for annotation values with default behavior
|
||||
* appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
|
||||
* 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™ 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
|
||||
* @since 1.8
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public class SimpleAnnotationValueVisitor8<R, P> extends SimpleAnnotationValueVisitor7<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses {@code null} for the
|
||||
* default value.
|
||||
*/
|
||||
protected SimpleAnnotationValueVisitor8() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses the argument for the
|
||||
* default value.
|
||||
*
|
||||
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
|
||||
*/
|
||||
protected SimpleAnnotationValueVisitor8(R defaultValue) {
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
|
@ -76,6 +76,7 @@ import static javax.lang.model.SourceVersion.*;
|
|||
* @author Peter von der Ahé
|
||||
*
|
||||
* @see SimpleElementVisitor7
|
||||
* @see SimpleElementVisitor8
|
||||
* @since 1.6
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_6)
|
||||
|
|
|
@ -69,6 +69,7 @@ import static javax.lang.model.SourceVersion.*;
|
|||
* for visitors that do not need an additional parameter.
|
||||
*
|
||||
* @see SimpleElementVisitor6
|
||||
* @see SimpleElementVisitor8
|
||||
* @since 1.7
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_7)
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.element.ElementKind.*;
|
||||
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_8 RELEASE_8}
|
||||
* source version.
|
||||
*
|
||||
* Visit methods corresponding to {@code RELEASE_7} 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
|
||||
* @since 1.8
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public class SimpleElementVisitor8<R, P> extends SimpleElementVisitor7<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses {@code null} for the
|
||||
* default value.
|
||||
*/
|
||||
protected SimpleElementVisitor8(){
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses the argument for the
|
||||
* default value.
|
||||
*
|
||||
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
|
||||
*/
|
||||
protected SimpleElementVisitor8(R defaultValue){
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
|
@ -75,6 +75,7 @@ import static javax.lang.model.SourceVersion.*;
|
|||
* @author Peter von der Ahé
|
||||
*
|
||||
* @see SimpleTypeVisitor7
|
||||
* @see SimpleTypeVisitor8
|
||||
* @since 1.6
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_6)
|
||||
|
|
|
@ -68,6 +68,7 @@ import static javax.lang.model.SourceVersion.*;
|
|||
* additional parameter.
|
||||
*
|
||||
* @see SimpleTypeVisitor6
|
||||
* @see SimpleTypeVisitor8
|
||||
* @since 1.7
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_7)
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.type.*;
|
||||
import javax.annotation.processing.SupportedSourceVersion;
|
||||
import javax.lang.model.SourceVersion;
|
||||
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.
|
||||
*
|
||||
* Visit methods corresponding to {@code RELEASE_8} 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™ 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_8)
|
||||
public class SimpleTypeVisitor8<R, P> extends SimpleTypeVisitor7<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses {@code null} for the
|
||||
* default value.
|
||||
*/
|
||||
protected SimpleTypeVisitor8(){
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses the argument for the
|
||||
* default value.
|
||||
*
|
||||
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
|
||||
*/
|
||||
protected SimpleTypeVisitor8(R defaultValue){
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, 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
|
||||
|
@ -76,6 +76,7 @@ import javax.lang.model.SourceVersion;
|
|||
* @author Peter von der Ahé
|
||||
*
|
||||
* @see TypeKindVisitor7
|
||||
* @see TypeKindVisitor8
|
||||
* @since 1.6
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_6)
|
||||
|
|
|
@ -71,6 +71,7 @@ import javax.lang.model.SourceVersion;
|
|||
* additional parameter.
|
||||
*
|
||||
* @see TypeKindVisitor6
|
||||
* @see TypeKindVisitor8
|
||||
* @since 1.7
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_7)
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.type.*;
|
||||
import javax.annotation.processing.SupportedSourceVersion;
|
||||
import static javax.lang.model.element.ElementKind.*;
|
||||
import static javax.lang.model.SourceVersion.*;
|
||||
import javax.lang.model.SourceVersion;
|
||||
|
||||
/**
|
||||
* A visitor of types based on their {@linkplain TypeKind kind} with
|
||||
* default behavior appropriate for the {@link SourceVersion#RELEASE_8
|
||||
* RELEASE_8} 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™ 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
|
||||
* @since 1.8
|
||||
*/
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public class TypeKindVisitor8<R, P> extends TypeKindVisitor7<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses to call; uses {@code null}
|
||||
* for the default value.
|
||||
*/
|
||||
protected TypeKindVisitor8() {
|
||||
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 TypeKindVisitor8(R defaultValue) {
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2011, 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_7. To return a fixed version, this class
|
||||
* like RELEASE_8. 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 ElementScanner7<Void, Void> {
|
||||
private class NameCheckScanner extends ElementScanner8<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
|
||||
|
|
33
langtools/test/com/sun/javadoc/T6735320/SerialFieldTest.java
Normal file
33
langtools/test/com/sun/javadoc/T6735320/SerialFieldTest.java
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
import java.io.ObjectStreamField;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SerialFieldTest implements Serializable {
|
||||
/**
|
||||
* @serialField
|
||||
*/
|
||||
private static final ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("i", int.class),
|
||||
};
|
||||
}
|
57
langtools/test/com/sun/javadoc/T6735320/T6735320.java
Normal file
57
langtools/test/com/sun/javadoc/T6735320/T6735320.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6735320
|
||||
* @summary javadoc throws exception if serialField value is missing
|
||||
* @library ../lib/
|
||||
* @build JavadocTester T6735320
|
||||
* @run main T6735320
|
||||
*/
|
||||
public class T6735320 extends JavadocTester {
|
||||
|
||||
private static final String BUG_ID = "6735320";
|
||||
private static final String[] ARGS = new String[]{
|
||||
"-d", BUG_ID + ".out",
|
||||
SRC_DIR + FS + "SerialFieldTest.java"
|
||||
};
|
||||
|
||||
public String getBugId() {
|
||||
return BUG_ID;
|
||||
}
|
||||
|
||||
public String getBugName() {
|
||||
return getClass().getName();
|
||||
}
|
||||
|
||||
public static void main(String... args) {
|
||||
T6735320 tester = new T6735320();
|
||||
if (tester.runJavadoc(ARGS) != 0) {
|
||||
throw new AssertionError("non-zero return code from javadoc");
|
||||
}
|
||||
if (tester.getErrorOutput().contains("StringIndexOutOfBoundsException")) {
|
||||
throw new AssertionError("javadoc threw StringIndexOutOfBoundsException");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, 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
|
||||
|
@ -197,8 +197,13 @@ public abstract class JavadocTester {
|
|||
initOutputBuffers();
|
||||
|
||||
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
|
||||
PrintStream prev = System.out;
|
||||
PrintStream prevOut = System.out;
|
||||
System.setOut(new PrintStream(stdout));
|
||||
|
||||
ByteArrayOutputStream stderr = new ByteArrayOutputStream();
|
||||
PrintStream prevErr = System.err;
|
||||
System.setErr(new PrintStream(stderr));
|
||||
|
||||
int returnCode = com.sun.tools.javadoc.Main.execute(
|
||||
getBugName(),
|
||||
new PrintWriter(errors, true),
|
||||
|
@ -207,8 +212,11 @@ public abstract class JavadocTester {
|
|||
docletClass,
|
||||
getClass().getClassLoader(),
|
||||
args);
|
||||
System.setOut(prev);
|
||||
System.setOut(prevOut);
|
||||
standardOut = new StringBuffer(stdout.toString());
|
||||
System.setErr(prevErr);
|
||||
errors.write(NL + stderr.toString());
|
||||
|
||||
printJavadocOutput();
|
||||
return returnCode;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2011, 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
|
||||
|
@ -95,7 +95,7 @@ public class CheckLocalElements extends Checker {
|
|||
return encl == null ? "" : encl.accept(qualNameVisitor, null);
|
||||
}
|
||||
|
||||
private ElementVisitor<String,Void> qualNameVisitor = new SimpleElementVisitor7<String,Void>() {
|
||||
private ElementVisitor<String,Void> qualNameVisitor = new SimpleElementVisitor8<String,Void>() {
|
||||
protected String defaultAction(Element e, Void ignore) {
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2011, 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
|
||||
|
@ -61,7 +61,7 @@ public class T6358166 extends AbstractProcessor {
|
|||
|
||||
Main compilerMain = new Main("javac", new PrintWriter(System.err, true));
|
||||
compilerMain.setOptions(Options.instance(context));
|
||||
compilerMain.filenames = new ListBuffer<File>();
|
||||
compilerMain.filenames = new LinkedHashSet<File>();
|
||||
compilerMain.processArgs(args);
|
||||
|
||||
JavaCompiler c = JavaCompiler.instance(context);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2011, 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,7 +72,7 @@ public class T6358168 extends AbstractProcessor {
|
|||
|
||||
Main compilerMain = new Main("javac", new PrintWriter(System.err, true));
|
||||
compilerMain.setOptions(Options.instance(context));
|
||||
compilerMain.filenames = new ListBuffer<File>();
|
||||
compilerMain.filenames = new LinkedHashSet<File>();
|
||||
compilerMain.processArgs(new String[] { "-d", "." });
|
||||
|
||||
JavaCompiler compiler = JavaCompiler.instance(context);
|
||||
|
@ -91,7 +91,7 @@ public class T6358168 extends AbstractProcessor {
|
|||
|
||||
Main compilerMain = new Main("javac", new PrintWriter(System.err, true));
|
||||
compilerMain.setOptions(Options.instance(context));
|
||||
compilerMain.filenames = new ListBuffer<File>();
|
||||
compilerMain.filenames = new LinkedHashSet<File>();
|
||||
compilerMain.processArgs(new String[] {
|
||||
"-XprintRounds",
|
||||
"-processorpath", testClasses,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, 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
|
||||
|
@ -26,7 +26,8 @@
|
|||
* @bug 6338064 6346249 6340951 6392177
|
||||
* @summary Tree API: can't determine kind of operator
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile TestOperators.java
|
||||
* @library ../lib
|
||||
* @build JavacTestingAbstractProcessor TestOperators
|
||||
* @compile -processor TestOperators -proc:only TestOperators.java
|
||||
*/
|
||||
|
||||
|
@ -46,7 +47,7 @@ import static com.sun.source.tree.Tree.Kind.*;
|
|||
}
|
||||
|
||||
@SupportedAnnotationTypes("TestMe")
|
||||
public class TestOperators extends AbstractProcessor {
|
||||
public class TestOperators extends JavacTestingAbstractProcessor {
|
||||
|
||||
@TestMe(POSTFIX_INCREMENT)
|
||||
public int test_POSTFIX_INCREMENT(int i) {
|
||||
|
@ -299,7 +300,7 @@ public class TestOperators extends AbstractProcessor {
|
|||
final Trees trees = Trees.instance(processingEnv);
|
||||
final Messager log = processingEnv.getMessager();
|
||||
final Elements elements = processingEnv.getElementUtils();
|
||||
class Scan extends ElementScanner7<Void,Void> {
|
||||
class Scan extends ElementScanner<Void,Void> {
|
||||
@Override
|
||||
public Void visitExecutable(ExecutableElement e, Void p) {
|
||||
Object debug = e; // info for exception handler
|
||||
|
@ -343,5 +344,4 @@ public class TestOperators extends AbstractProcessor {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2011, 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
|
||||
|
@ -23,10 +23,11 @@
|
|||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6350057
|
||||
* @bug 6350057 7025809
|
||||
* @summary Test that parameters on implicit enum methods have the right kind
|
||||
* @author Joseph D. Darcy
|
||||
* @compile T6350057.java
|
||||
* @library ../../lib
|
||||
* @build JavacTestingAbstractProcessor T6350057
|
||||
* @compile -processor T6350057 -proc:only TestEnum.java
|
||||
*/
|
||||
|
||||
|
@ -38,9 +39,8 @@ import javax.lang.model.element.*;
|
|||
import javax.lang.model.util.*;
|
||||
import static javax.tools.Diagnostic.Kind.*;
|
||||
|
||||
@SupportedAnnotationTypes("*")
|
||||
public class T6350057 extends AbstractProcessor {
|
||||
static class LocalVarAllergy extends ElementKindVisitor6<Boolean, Void> {
|
||||
public class T6350057 extends JavacTestingAbstractProcessor {
|
||||
static class LocalVarAllergy extends ElementKindVisitor<Boolean, Void> {
|
||||
@Override
|
||||
public Boolean visitTypeAsEnum(TypeElement e, Void v) {
|
||||
System.out.println("visitTypeAsEnum: " + e.getSimpleName().toString());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2011, 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
|
||||
|
@ -23,10 +23,11 @@
|
|||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6424358
|
||||
* @bug 6424358 7025809
|
||||
* @summary Synthesized static enum method values() is final
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile T6424358.java
|
||||
* @library ../../lib
|
||||
* @build JavacTestingAbstractProcessor T6424358
|
||||
* @compile -processor T6424358 -proc:only T6424358.java
|
||||
*/
|
||||
|
||||
|
@ -39,8 +40,7 @@ import static javax.tools.Diagnostic.Kind.*;
|
|||
|
||||
@interface TestMe {}
|
||||
|
||||
@SupportedAnnotationTypes("*")
|
||||
public class T6424358 extends AbstractProcessor {
|
||||
public class T6424358 extends JavacTestingAbstractProcessor {
|
||||
@TestMe enum Test { FOO; }
|
||||
|
||||
public boolean process(Set<? extends TypeElement> annotations,
|
||||
|
@ -48,7 +48,7 @@ public class T6424358 extends AbstractProcessor {
|
|||
final Messager log = processingEnv.getMessager();
|
||||
final Elements elements = processingEnv.getElementUtils();
|
||||
final TypeElement testMe = elements.getTypeElement("TestMe");
|
||||
class Scan extends ElementScanner7<Void,Void> {
|
||||
class Scan extends ElementScanner<Void,Void> {
|
||||
@Override
|
||||
public Void visitExecutable(ExecutableElement e, Void p) {
|
||||
System.err.println("Looking at " + e);
|
||||
|
@ -65,9 +65,4 @@ public class T6424358 extends AbstractProcessor {
|
|||
scan.scan(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
FailOver15.java:17:10: compiler.err.expected: ';'
|
||||
FailOver15.java:11:13: compiler.err.cant.resolve.location: kindname.class, UnknownClass, , , (compiler.misc.location: kindname.class, Test, null)
|
||||
2 errors
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.*;
|
|||
import javax.annotation.processing.*;
|
||||
import javax.lang.model.SourceVersion;
|
||||
import javax.lang.model.util.*;
|
||||
import static javax.lang.model.SourceVersion.*;
|
||||
|
||||
/**
|
||||
* An abstract annotation processor tailored to javac regression testing.
|
||||
|
@ -95,4 +96,164 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
|
|||
messager = processingEnv.getMessager();
|
||||
options = processingEnv.getOptions();
|
||||
}
|
||||
|
||||
/*
|
||||
* The set of visitors below will directly extend the most recent
|
||||
* corresponding platform visitor type.
|
||||
*/
|
||||
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor8<R, P> {
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses to call.
|
||||
*/
|
||||
protected AbstractAnnotationValueVisitor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor8<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses to call.
|
||||
*/
|
||||
protected AbstractElementVisitor(){
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public static abstract class AbstractTypeVisitor<R, P> extends AbstractTypeVisitor8<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses to call.
|
||||
*/
|
||||
protected AbstractTypeVisitor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public static class ElementKindVisitor<R, P> extends ElementKindVisitor8<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses {@code null} for the
|
||||
* default value.
|
||||
*/
|
||||
protected ElementKindVisitor() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses the argument for the
|
||||
* default value.
|
||||
*
|
||||
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
|
||||
*/
|
||||
protected ElementKindVisitor(R defaultValue) {
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public static class ElementScanner<R, P> extends ElementScanner8<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses {@code null} for the
|
||||
* default value.
|
||||
*/
|
||||
protected ElementScanner(){
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses the argument for the
|
||||
* default value.
|
||||
*/
|
||||
protected ElementScanner(R defaultValue){
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public static class SimpleAnnotationValueVisitor<R, P> extends SimpleAnnotationValueVisitor8<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses {@code null} for the
|
||||
* default value.
|
||||
*/
|
||||
protected SimpleAnnotationValueVisitor() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses the argument for the
|
||||
* default value.
|
||||
*
|
||||
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
|
||||
*/
|
||||
protected SimpleAnnotationValueVisitor(R defaultValue) {
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor8<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses {@code null} for the
|
||||
* default value.
|
||||
*/
|
||||
protected SimpleElementVisitor(){
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses the argument for the
|
||||
* default value.
|
||||
*
|
||||
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
|
||||
*/
|
||||
protected SimpleElementVisitor(R defaultValue){
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public static class SimpleTypeVisitor<R, P> extends SimpleTypeVisitor8<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses {@code null} for the
|
||||
* default value.
|
||||
*/
|
||||
protected SimpleTypeVisitor(){
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for concrete subclasses; uses the argument for the
|
||||
* default value.
|
||||
*
|
||||
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
|
||||
*/
|
||||
protected SimpleTypeVisitor(R defaultValue){
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@SupportedSourceVersion(RELEASE_8)
|
||||
public static class TypeKindVisitor<R, P> extends TypeKindVisitor8<R, P> {
|
||||
/**
|
||||
* Constructor for concrete subclasses to call; uses {@code null}
|
||||
* for the default value.
|
||||
*/
|
||||
protected TypeKindVisitor() {
|
||||
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 TypeKindVisitor(R defaultValue) {
|
||||
super(defaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6993963
|
||||
* @bug 6993963 7025809
|
||||
* @summary Project Coin: Use precise exception analysis for effectively final catch parameters
|
||||
* @library ../../lib
|
||||
* @build JavacTestingAbstractProcessor ModelChecker
|
||||
|
@ -107,7 +107,7 @@ public class ModelChecker extends JavacTestingAbstractProcessor {
|
|||
; // Expected
|
||||
}
|
||||
|
||||
UnionType unionType = new SimpleTypeVisitor7<UnionType, Void>(){
|
||||
UnionType unionType = new SimpleTypeVisitor<UnionType, Void>(){
|
||||
@Override
|
||||
protected UnionType defaultAction(TypeMirror e, Void p) {return null;}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2011, 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
|
||||
|
@ -21,7 +21,7 @@
|
|||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
/*
|
||||
* @test
|
||||
* @bug 6194785
|
||||
* @summary ParameterDeclaration.getSimpleName does not return actual name from class files
|
||||
|
@ -40,9 +40,8 @@ import static javax.tools.Diagnostic.Kind.*;
|
|||
|
||||
public class T6194785 extends JavacTestingAbstractProcessor {
|
||||
public boolean process(Set<? extends TypeElement> annotations,
|
||||
RoundEnvironment roundEnvironment)
|
||||
{
|
||||
class Scan extends ElementScanner7<Void,Void> {
|
||||
RoundEnvironment roundEnvironment) {
|
||||
class Scan extends ElementScanner<Void,Void> {
|
||||
@Override
|
||||
public Void visitExecutable(ExecutableElement e, Void ignored) {
|
||||
for (VariableElement p : e.getParameters())
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
/*
|
||||
* @test
|
||||
* @bug 7021183
|
||||
* @bug 7021183 7025809
|
||||
* @summary 269: assertion failure getting enclosing element of an undefined name
|
||||
*/
|
||||
|
||||
|
@ -37,9 +37,7 @@ import javax.lang.model.element.UnknownElementException;
|
|||
import javax.lang.model.element.VariableElement;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.type.UnknownTypeException;
|
||||
import javax.lang.model.util.ElementScanner7;
|
||||
import javax.lang.model.util.SimpleTypeVisitor7;
|
||||
import javax.lang.model.util.Types;
|
||||
import javax.lang.model.util.*;
|
||||
|
||||
import com.sun.tools.javac.code.Symbol.ClassSymbol;
|
||||
import com.sun.tools.javac.code.Symtab;
|
||||
|
@ -112,7 +110,7 @@ public class TestSymtabItems {
|
|||
|
||||
int errors;
|
||||
|
||||
class ElemPrinter extends ElementScanner7<Void, Void> {
|
||||
class ElemPrinter extends ElementScanner8<Void, Void> {
|
||||
@Override
|
||||
public Void visitPackage(PackageElement e, Void p) {
|
||||
show("package", e);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6639645 7026414
|
||||
* @bug 6639645 7026414 7025809
|
||||
* @summary Modeling type implementing missing interfaces
|
||||
* @library ../../../../lib
|
||||
* @build JavacTestingAbstractProcessor TestMissingElement
|
||||
|
@ -104,7 +104,7 @@ public class TestMissingElement extends JavacTestingAbstractProcessor {
|
|||
private String asString(TypeMirror t) {
|
||||
if (t == null)
|
||||
return "[typ:null]";
|
||||
return t.accept(new SimpleTypeVisitor7<String, Void>() {
|
||||
return t.accept(new SimpleTypeVisitor<String, Void>() {
|
||||
@Override
|
||||
public String defaultAction(TypeMirror t, Void ignore) {
|
||||
return "[typ:" + t.toString() + "]";
|
||||
|
@ -135,7 +135,7 @@ public class TestMissingElement extends JavacTestingAbstractProcessor {
|
|||
private String asString(Element e) {
|
||||
if (e == null)
|
||||
return "[elt:null]";
|
||||
return e.accept(new SimpleElementVisitor7<String, Void>() {
|
||||
return e.accept(new SimpleElementVisitor<String, Void>() {
|
||||
@Override
|
||||
public String defaultAction(Element e, Void ignore) {
|
||||
return "[elt:" + e.getKind() + " " + e.toString() + "]";
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6911256 6964740 6967842 6961571
|
||||
* @bug 6911256 6964740 6967842 6961571 7025809
|
||||
* @summary Test that the resource variable kind is appropriately set
|
||||
* @author Joseph D. Darcy
|
||||
* @library ../../../lib
|
||||
|
@ -44,8 +44,8 @@ import static javax.tools.Diagnostic.Kind.*;
|
|||
|
||||
/**
|
||||
* Using the tree API, retrieve element representations of the
|
||||
* resource of an ARM block and verify their kind tags are set
|
||||
* appropriately.
|
||||
* resource of a try-with-resources statement and verify their kind
|
||||
* tags are set appropriately.
|
||||
*/
|
||||
public class TestResourceVariable extends JavacTestingAbstractProcessor implements AutoCloseable {
|
||||
int resourceVariableCount = 0;
|
||||
|
@ -82,7 +82,7 @@ public class TestResourceVariable extends JavacTestingAbstractProcessor implemen
|
|||
|
||||
/**
|
||||
* Verify that a resource variable modeled as an element behaves
|
||||
* as expected under 6 and 7 specific visitors.
|
||||
* as expected under 6 and latest specific visitors.
|
||||
*/
|
||||
private static void testResourceVariable(Element element) {
|
||||
ElementVisitor visitor6 = new ElementKindVisitor6<Void, Void>() {};
|
||||
|
@ -94,7 +94,8 @@ public class TestResourceVariable extends JavacTestingAbstractProcessor implemen
|
|||
; // Expected.
|
||||
}
|
||||
|
||||
ElementKindVisitor7 visitor7 = new ElementKindVisitor7<Object, Void>() {
|
||||
ElementKindVisitor visitorLatest =
|
||||
new ElementKindVisitor<Object, Void>() {
|
||||
@Override
|
||||
public Object visitVariableAsResourceVariable(VariableElement e,
|
||||
Void p) {
|
||||
|
@ -102,7 +103,7 @@ public class TestResourceVariable extends JavacTestingAbstractProcessor implemen
|
|||
}
|
||||
};
|
||||
|
||||
if (visitor7.visit(element) == null) {
|
||||
if (visitorLatest.visit(element) == null) {
|
||||
throw new RuntimeException("Null result of resource variable visitation.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2011, 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
|
||||
|
@ -23,7 +23,7 @@
|
|||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6418666 6423973 6453386
|
||||
* @bug 6418666 6423973 6453386 7025809
|
||||
* @summary Test the NoTypes: VOID, PACKAGE, NONE
|
||||
* @author Scott Seligman
|
||||
* @library ../../../lib
|
||||
|
@ -75,7 +75,7 @@ public class NoTypes extends JavacTestingAbstractProcessor {
|
|||
verifyKind(NONE, types.getNoType(NONE));
|
||||
|
||||
// The return type of a constructor or void method is VOID.
|
||||
class Scanner extends ElementScanner7<Void, Void> {
|
||||
class Scanner extends ElementScanner<Void, Void> {
|
||||
@Override
|
||||
public Void visitExecutable(ExecutableElement e, Void p) {
|
||||
verifyKind(VOID, e.getReturnType());
|
||||
|
@ -89,11 +89,11 @@ public class NoTypes extends JavacTestingAbstractProcessor {
|
|||
}
|
||||
|
||||
/**
|
||||
* Verify that a NoType instance is of a particular kind,
|
||||
* and that TypeKindVisitor7 properly dispatches on it.
|
||||
* Verify that a NoType instance is of a particular kind, and that
|
||||
* the latest TypeKindVisitor properly dispatches on it.
|
||||
*/
|
||||
private void verifyKind(TypeKind kind, TypeMirror type) {
|
||||
class Vis extends TypeKindVisitor7<TypeKind, Void> {
|
||||
class Vis extends TypeKindVisitor<TypeKind, Void> {
|
||||
@Override
|
||||
public TypeKind visitNoTypeAsVoid(NoType t, Void p) {
|
||||
return VOID;
|
||||
|
@ -111,9 +111,7 @@ public class NoTypes extends JavacTestingAbstractProcessor {
|
|||
throw new AssertionError();
|
||||
}
|
||||
|
||||
|
||||
// Fodder for the tests
|
||||
|
||||
interface I {
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
/*
|
||||
* @test
|
||||
* @bug 7029150
|
||||
* @bug 7029150 7025809
|
||||
* @summary Test support for union types
|
||||
* @library ../../../lib
|
||||
*/
|
||||
|
@ -39,7 +39,6 @@ import javax.tools.*;
|
|||
import com.sun.source.tree.*;
|
||||
import com.sun.source.util.*;
|
||||
|
||||
|
||||
public class TestUnionType extends JavacTestingAbstractProcessor {
|
||||
enum TestKind {
|
||||
SingleType("E1", "E1",
|
||||
|
@ -194,7 +193,7 @@ public class TestUnionType extends JavacTestingAbstractProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
class TypePrinter extends SimpleTypeVisitor7<String, Void> {
|
||||
class TypePrinter extends SimpleTypeVisitor<String, Void> {
|
||||
@Override
|
||||
protected String defaultAction(TypeMirror tm, Void ignore) {
|
||||
return String.valueOf(tm.getKind());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2011 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
|
||||
|
@ -68,7 +68,7 @@ public class TestDeprecation extends JavacTestingAbstractProcessor {
|
|||
return true;
|
||||
}
|
||||
|
||||
private class DeprecationChecker extends ElementScanner7<Boolean,Void> {
|
||||
private class DeprecationChecker extends ElementScanner<Boolean,Void> {
|
||||
private Elements elementUtils;
|
||||
private boolean failure;
|
||||
DeprecationChecker() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue