8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java

Only enabling the DefinedByAnalyzer on java.compiler and jdk.compiler; removing the @DefinedBy annotations from other modules

Reviewed-by: jjg, ksrini
This commit is contained in:
Jan Lahoda 2016-08-29 20:55:24 +02:00
parent 2df08320de
commit dc0db76409
20 changed files with 260 additions and 307 deletions

View File

@ -23,10 +23,15 @@
package crules;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import com.sun.source.util.JavacTask;
import com.sun.source.util.TaskEvent.Kind;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Symbol.MethodSymbol;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
import com.sun.tools.javac.tree.TreeScanner;
import com.sun.tools.javac.util.DefinedBy;
@ -44,7 +49,20 @@ public class DefinedByAnalyzer extends AbstractCodingRulesAnalyzer {
eventKind = Kind.ANALYZE;
}
//only java.compiler and jdk.compiler modules implement the APIs,
//so only these need the @DefinedBy annotation:
private static final Set<String> MODULE = new HashSet<>(Arrays.asList(
"java.compiler",
"jdk.compiler"
));
class DefinedByVisitor extends TreeScanner {
@Override
public void visitClassDef(JCClassDecl tree) {
if (MODULE.contains(tree.sym.packge().modle.name.toString())) {
super.visitClassDef(tree);
}
}
@Override
public void visitMethodDef(JCMethodDecl tree) {
if (!isAPIPackage(packageName(tree.sym))) {

View File

@ -34,8 +34,6 @@ import javax.tools.JavaFileObject;
import com.sun.tools.javac.util.ClientCodeException;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import jdk.javadoc.internal.tool.Start;
/**
@ -68,14 +66,12 @@ public class JavadocTaskImpl implements DocumentationTask {
setLocale(Locale.getDefault());
}
@DefinedBy(Api.COMPILER)
public void setLocale(Locale locale) {
if (used.get())
throw new IllegalStateException();
this.locale = locale;
}
@DefinedBy(Api.COMPILER)
public Boolean call() {
if (!used.getAndSet(true)) {
initContext();

View File

@ -49,8 +49,6 @@ import com.sun.tools.javac.file.JavacFileManager;
import com.sun.tools.javac.file.BaseFileManager;
import com.sun.tools.javac.util.ClientCodeException;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.Log;
import jdk.javadoc.internal.tool.ToolOption;
@ -64,7 +62,7 @@ import jdk.javadoc.internal.tool.ToolOption;
* or deletion without notice.</b></p>
*/
public class JavadocTool implements DocumentationTool {
@Override @DefinedBy(Api.COMPILER)
@Override
public DocumentationTask getTask(
Writer out,
JavaFileManager fileManager,
@ -129,7 +127,7 @@ public class JavadocTool implements DocumentationTool {
}
// TODO: used shared static method in JavacFileManager
@Override @DefinedBy(Api.COMPILER)
@Override
public StandardJavaFileManager getStandardFileManager(
DiagnosticListener<? super JavaFileObject> diagnosticListener,
Locale locale,
@ -145,7 +143,7 @@ public class JavadocTool implements DocumentationTool {
return new JavacFileManager(context, true, charset);
}
@Override @DefinedBy(Api.COMPILER)
@Override
public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
PrintWriter err_pw = new PrintWriter(err == null ? System.err : err, true);
PrintWriter out_pw = new PrintWriter(out == null ? System.out : out);
@ -157,13 +155,13 @@ public class JavadocTool implements DocumentationTool {
}
}
@Override @DefinedBy(Api.COMPILER)
@Override
public Set<SourceVersion> getSourceVersions() {
return Collections.unmodifiableSet(
EnumSet.range(SourceVersion.RELEASE_3, SourceVersion.latest()));
}
@Override @DefinedBy(Api.COMPILER)
@Override
public int isSupportedOption(String option) {
if (option == null)
throw new NullPointerException();

View File

@ -39,8 +39,6 @@ import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVariable;
import javax.lang.model.util.SimpleTypeVisitor9;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.toolkit.Content;
@ -314,27 +312,27 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
SimpleTypeVisitor9<Boolean, Void> stv = new SimpleTypeVisitor9<Boolean, Void>() {
boolean foundTypeVariable = false;
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitArray(ArrayType t, Void p) {
visit(t.getComponentType());
buf.append(utils.getDimension(t));
return foundTypeVariable;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitTypeVariable(TypeVariable t, Void p) {
buf.append(utils.asTypeElement(t).getQualifiedName());
foundTypeVariable = true;
return foundTypeVariable;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitDeclared(DeclaredType t, Void p) {
buf.append(utils.getQualifiedTypeName(t));
return foundTypeVariable;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Boolean defaultAction(TypeMirror e, Void p) {
buf.append(e);
return foundTypeVariable;

View File

@ -37,7 +37,6 @@ import javax.lang.model.element.TypeElement;
import javax.lang.model.util.SimpleElementVisitor9;
import com.sun.source.doctree.DocTree;
import com.sun.tools.javac.util.DefinedBy;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@ -183,7 +182,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
SearchIndexItem si = new SearchIndexItem();
new SimpleElementVisitor9<Void, Void>() {
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
@Override
public Void visitModule(ModuleElement e, Void p) {
if (configuration.showModules) {
addDescription(e, dl, si);
@ -192,21 +191,21 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
return null;
}
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
@Override
public Void visitPackage(PackageElement e, Void p) {
addDescription(e, dl, si);
configuration.packageSearchIndex.add(si);
return null;
}
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
@Override
public Void visitType(TypeElement e, Void p) {
addDescription(e, dl, si);
configuration.typeSearchIndex.add(si);
return null;
}
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
@Override
protected Void defaultAction(Element e, Void p) {
addDescription(e, dl, si);
configuration.memberSearchIndex.add(si);

View File

@ -36,8 +36,6 @@ import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.SimpleElementVisitor8;
import com.sun.source.doctree.DocTree;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@ -560,7 +558,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
if (outerClass == null)
return;
new SimpleElementVisitor8<Void, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitType(TypeElement e, Void p) {
Content label = utils.isInterface(e)
? contents.enclosingInterfaceLabel

View File

@ -62,8 +62,6 @@ import com.sun.source.doctree.SeeTree;
import com.sun.source.doctree.StartElementTree;
import com.sun.source.doctree.TextTree;
import com.sun.source.util.SimpleDocTreeVisitor;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import jdk.javadoc.internal.doclets.formats.html.markup.Comment;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
@ -1835,7 +1833,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitAttribute(AttributeTree node, Content c) {
StringBuilder sb = new StringBuilder(SPACER).append(node.getName());
if (node.getValueKind() == ValueKind.EMPTY) {
@ -1884,7 +1882,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitComment(CommentTree node, Content c) {
if (isFirstSentence && isFirst(node)) {
commentRemoved = true;
@ -1902,7 +1900,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return content;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitDocRoot(DocRootTree node, Content c) {
Content docRootContent = TagletWriter.getInlineTagOutput(element,
configuration.tagletManager,
@ -1917,20 +1915,20 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitEndElement(EndElementTree node, Content c) {
RawHtml rawHtml = new RawHtml("</" + node.getName() + ">");
result.addContent(rawHtml);
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitEntity(EntityTree node, Content c) {
result.addContent(new RawHtml(node.toString()));
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitErroneous(ErroneousTree node, Content c) {
messages.warning(ch.getDocTreePath(node),
"doclet.tag.invalid_usage", node);
@ -1938,7 +1936,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitInheritDoc(InheritDocTree node, Content c) {
Content output = TagletWriter.getInlineTagOutput(element,
configuration.tagletManager, holderTag,
@ -1948,7 +1946,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return (isFirstSentence && !output.isEmpty());
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitIndex(IndexTree node, Content p) {
Content output = TagletWriter.getInlineTagOutput(element,
configuration.tagletManager, holderTag, tag,
@ -1959,14 +1957,14 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitLink(LinkTree node, Content c) {
// we need to pass the DocTreeImpl here, so ignore node
result.addContent(seeTagToContent(element, tag));
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitLiteral(LiteralTree node, Content c) {
String s = node.getBody().toString();
Content content = new StringContent(utils.normalizeNewlines(s));
@ -1976,14 +1974,14 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitSee(SeeTree node, Content c) {
// we need to pass the DocTreeImpl here, so ignore node
result.addContent(seeTagToContent(element, tag));
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitStartElement(StartElementTree node, Content c) {
String text = "<" + node.getName();
RawHtml rawHtml = new RawHtml(utils.normalizeNewlines(text));
@ -2011,7 +2009,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return utils.normalizeNewlines(text);
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Boolean visitText(TextTree node, Content c) {
String text = node.getBody();
result.addContent(new RawHtml(textCleanup(text, isLast(node), commentRemoved)));
@ -2019,7 +2017,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return false;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
protected Boolean defaultAction(DocTree node, Content c) {
Content output = TagletWriter.getInlineTagOutput(element,
configuration.tagletManager, holderTag, tag,
@ -2097,27 +2095,27 @@ public class HtmlDocletWriter extends HtmlDocWriter {
}
DocPath redirectPathFromRoot = new SimpleElementVisitor9<DocPath, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public DocPath visitType(TypeElement e, Void p) {
return DocPath.forPackage(utils.containingPackage(e));
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public DocPath visitPackage(PackageElement e, Void p) {
return DocPath.forPackage(e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public DocPath visitVariable(VariableElement e, Void p) {
return DocPath.forPackage(utils.containingPackage(e));
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public DocPath visitExecutable(ExecutableElement e, Void p) {
return DocPath.forPackage(utils.containingPackage(e));
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected DocPath defaultAction(Element e, Void p) {
return null;
}
@ -2378,13 +2376,13 @@ public class HtmlDocletWriter extends HtmlDocWriter {
List<AnnotationValue> annotationTypeValues = new ArrayList<>();
new SimpleAnnotationValueVisitor9<Void, List<AnnotationValue>>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitArray(List<? extends AnnotationValue> vals, List<AnnotationValue> p) {
p.addAll(vals);
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Void defaultAction(Object o, List<AnnotationValue> p) {
p.add(annotationValue);
return null;
@ -2406,7 +2404,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
List<AnnotationValue> annotationTypeValues = new ArrayList<>();
for (AnnotationValue a : pairs.values()) {
new SimpleAnnotationValueVisitor9<Void, List<AnnotationValue>>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitArray(List<? extends AnnotationValue> vals, List<AnnotationValue> annotationTypeValues) {
for (AnnotationValue av : vals) {
annotationTypeValues.add(av);
@ -2482,12 +2480,12 @@ public class HtmlDocletWriter extends HtmlDocWriter {
AnnotationValue annotationValue = map.get(element);
List<AnnotationValue> annotationTypeValues = new ArrayList<>();
new SimpleAnnotationValueVisitor9<Void, AnnotationValue>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitArray(List<? extends AnnotationValue> vals, AnnotationValue p) {
annotationTypeValues.addAll(vals);
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Void defaultAction(Object o, AnnotationValue p) {
annotationTypeValues.add(p);
return null;
@ -2520,13 +2518,13 @@ public class HtmlDocletWriter extends HtmlDocWriter {
for (ExecutableElement ee : pairs.keySet()) {
annotationValue = pairs.get(ee);
boolean rvalue = new SimpleAnnotationValueVisitor9<Boolean, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitArray(List<? extends AnnotationValue> vals, Void p) {
if (vals.size() > 1) {
if (vals.get(0) instanceof AnnotationMirror) {
isContainerDocumented = true;
return new SimpleAnnotationValueVisitor9<Boolean, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitAnnotation(AnnotationMirror a, Void p) {
isContainerDocumented = true;
Element asElement = a.getAnnotationType().asElement();
@ -2535,7 +2533,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
}
return true;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Boolean defaultAction(Object o, Void p) {
return false;
}
@ -2545,7 +2543,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return false;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Boolean defaultAction(Object o, Void p) {
return false;
}
@ -2560,10 +2558,10 @@ public class HtmlDocletWriter extends HtmlDocWriter {
private Content annotationValueToContent(AnnotationValue annotationValue) {
return new SimpleAnnotationValueVisitor9<Content, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Content visitType(TypeMirror t, Void p) {
return new SimpleTypeVisitor9<Content, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Content visitDeclared(DeclaredType t, Void p) {
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.ANNOTATION, t);
@ -2573,13 +2571,13 @@ public class HtmlDocletWriter extends HtmlDocWriter {
linkInfo.label = new StringContent(name + utils.getDimension(t) + ".class");
return getLink(linkInfo);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Content defaultAction(TypeMirror e, Void p) {
return new StringContent(t + utils.getDimension(t) + ".class");
}
}.visit(t);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Content visitAnnotation(AnnotationMirror a, Void p) {
List<Content> list = getAnnotations(0, a, false);
ContentBuilder buf = new ContentBuilder();
@ -2588,12 +2586,12 @@ public class HtmlDocletWriter extends HtmlDocWriter {
}
return buf;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Content visitEnumConstant(VariableElement c, Void p) {
return getDocLink(LinkInfoImpl.Kind.ANNOTATION,
c, c.getSimpleName(), false);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Content visitArray(List<? extends AnnotationValue> vals, Void p) {
ContentBuilder buf = new ContentBuilder();
String sep = "";
@ -2604,7 +2602,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
}
return buf;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Content defaultAction(Object o, Void p) {
return new StringContent(annotationValue.toString());
}

View File

@ -37,7 +37,6 @@ import javax.lang.model.util.SimpleElementVisitor9;
import com.sun.source.doctree.DocTree;
import com.sun.source.doctree.IndexTree;
import com.sun.tools.javac.util.DefinedBy;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
@ -113,14 +112,14 @@ public class TagletWriterImpl extends TagletWriter {
si.setLabel(tagText);
si.setDescription(desc);
new SimpleElementVisitor9<Void, Void>() {
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
@Override
public Void visitModule(ModuleElement e, Void p) {
si.setUrl(DocPaths.moduleSummary(e).getPath() + "#" + anchorName);
si.setHolder(utils.getSimpleName(element));
return null;
}
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
@Override
public Void visitPackage(PackageElement e, Void p) {
si.setUrl(DocPath.forPackage(e).getPath()
+ "/" + DocPaths.PACKAGE_SUMMARY.getPath() + "#" + anchorName);
@ -128,14 +127,14 @@ public class TagletWriterImpl extends TagletWriter {
return null;
}
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
@Override
public Void visitType(TypeElement e, Void p) {
si.setUrl(DocPath.forClass(utils, e).getPath() + "#" + anchorName);
si.setHolder(utils.getFullyQualifiedName(e));
return null;
}
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
@Override
public Void visitVariable(VariableElement e, Void p) {
TypeElement te = utils.getEnclosingTypeElement(e);
si.setUrl(DocPath.forClass(utils, te).getPath() + "#" + anchorName);
@ -143,7 +142,7 @@ public class TagletWriterImpl extends TagletWriter {
return null;
}
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
@Override
protected Void defaultAction(Element e, Void p) {
TypeElement te = utils.getEnclosingTypeElement(e);
si.setUrl(DocPath.forClass(utils, te).getPath() + "#" + anchorName);

View File

@ -35,8 +35,6 @@ import javax.lang.model.element.ElementVisitor;
import javax.lang.model.element.Name;
import javax.lang.model.type.TypeMirror;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import jdk.javadoc.doclet.DocletEnvironment;
/**
@ -56,52 +54,52 @@ public class OverviewElement implements Element {
this.docEnv = docEnv;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public TypeMirror asType() {
throw new UnsupportedOperationException("Unsupported method");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public ElementKind getKind() {
return ElementKind.OTHER;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Set<javax.lang.model.element.Modifier> getModifiers() {
throw new UnsupportedOperationException("Unsupported method");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Name getSimpleName() {
throw new UnsupportedOperationException("Unsupported method");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Element getEnclosingElement() {
throw new UnsupportedOperationException("Unsupported method");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public java.util.List<? extends Element> getEnclosedElements() {
throw new UnsupportedOperationException("Unsupported method");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public java.util.List<? extends AnnotationMirror> getAnnotationMirrors() {
throw new UnsupportedOperationException("Unsupported method");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
throw new UnsupportedOperationException("Unsupported method");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
return v.visitUnknown(this, p);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
throw new UnsupportedOperationException("Unsupported method");
}

View File

@ -39,8 +39,6 @@ import javax.tools.JavaFileManager;
import javax.tools.StandardJavaFileManager;
import com.sun.source.doctree.DocTree;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import jdk.javadoc.internal.doclets.toolkit.Configuration;
import jdk.javadoc.internal.doclets.toolkit.Messages;
import jdk.javadoc.internal.doclets.toolkit.Resources;
@ -377,7 +375,7 @@ public class TagletManager {
return;
}
new SimpleElementVisitor9<Void, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitModule(ModuleElement e, Void p) {
if (!taglet.inModule()) {
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "module");
@ -385,7 +383,7 @@ public class TagletManager {
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitPackage(PackageElement e, Void p) {
if (!taglet.inPackage()) {
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "package");
@ -393,7 +391,7 @@ public class TagletManager {
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitType(TypeElement e, Void p) {
if (!taglet.inType()) {
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "class");
@ -401,7 +399,7 @@ public class TagletManager {
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitExecutable(ExecutableElement e, Void p) {
if (utils.isConstructor(e) && !taglet.inConstructor()) {
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "constructor");
@ -411,7 +409,7 @@ public class TagletManager {
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitVariable(VariableElement e, Void p) {
if (utils.isField(e) && !taglet.inField()) {
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "field");
@ -419,7 +417,7 @@ public class TagletManager {
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitUnknown(Element e, Void p) {
if (utils.isOverviewElement(e) && !taglet.inOverview()) {
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "overview");
@ -427,7 +425,7 @@ public class TagletManager {
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Void defaultAction(Element e, Void p) {
return null;
}

View File

@ -44,8 +44,6 @@ import javax.lang.model.util.SimpleElementVisitor9;
import javax.lang.model.util.SimpleTypeVisitor9;
import javax.lang.model.util.Types;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import jdk.javadoc.doclet.DocletEnvironment;
import jdk.javadoc.internal.doclets.formats.html.ConfigurationImpl;
@ -219,17 +217,17 @@ public class ClassUseMapper {
mapTypeParameters(classToFieldTypeParam, fd, fd);
mapAnnotations(annotationToField, fd, fd);
SimpleTypeVisitor9<Void, VariableElement> stv = new SimpleTypeVisitor9<Void, VariableElement>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitArray(ArrayType t, VariableElement p) {
return visit(t.getComponentType(), p);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitDeclared(DeclaredType t, VariableElement p) {
add(classToField, (TypeElement) t.asElement(), p);
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitTypeVariable(TypeVariable t, VariableElement p) {
return visit(typeUtils.erasure(t), p);
}
@ -249,7 +247,7 @@ public class ClassUseMapper {
mapTypeParameters(classToMethodTypeParam, method, method);
mapAnnotations(classToMethodAnnotations, method, method);
SimpleTypeVisitor9<Void, ExecutableElement> stv = new SimpleTypeVisitor9<Void, ExecutableElement>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitArray(ArrayType t, ExecutableElement p) {
TypeMirror componentType = t.getComponentType();
return visit(utils.isTypeVariable(componentType)
@ -257,14 +255,14 @@ public class ClassUseMapper {
: componentType, p);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitDeclared(DeclaredType t, ExecutableElement p) {
mapTypeParameters(classToMethodReturnTypeParam, t, p);
add(classToMethodReturn, (TypeElement) t.asElement(), p);
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Void defaultAction(TypeMirror e, ExecutableElement p) {
return null;
}
@ -349,12 +347,12 @@ public class ClassUseMapper {
// no duplicates please
if (classArgs.add(pType)) {
new SimpleTypeVisitor9<Void, ExecutableElement>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitArray(ArrayType t, ExecutableElement p) {
return visit(t.getComponentType(), p);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitDeclared(DeclaredType t, ExecutableElement p) {
add(isConstructor
? classToConstructorArgs
@ -362,7 +360,7 @@ public class ClassUseMapper {
(TypeElement) t.asElement(), p);
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitTypeVariable(TypeVariable t, ExecutableElement p) {
visit(typeUtils.erasure(t), p);
return null;
@ -383,27 +381,27 @@ public class ClassUseMapper {
for (TypeMirror anException : ee.getThrownTypes()) {
SimpleTypeVisitor9<Void, ExecutableElement> stv = new SimpleTypeVisitor9<Void, ExecutableElement>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitArray(ArrayType t, ExecutableElement p) {
super.visit(t.getComponentType(), p);
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitDeclared(DeclaredType t, ExecutableElement p) {
add(isConstructor ? classToConstructorThrows : classToMethodThrows,
(TypeElement) t.asElement(), p);
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitError(ErrorType t, ExecutableElement p) {
add(isConstructor ? classToConstructorThrows : classToMethodThrows,
(TypeElement) t.asElement(), p);
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Void defaultAction(TypeMirror e, ExecutableElement p) {
throw new AssertionError("this should not happen");
}
@ -488,7 +486,7 @@ public class ClassUseMapper {
}
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitType(TypeElement e, Void p) {
for (TypeParameterElement param : e.getTypeParameters()) {
addParameters(param);
@ -496,7 +494,7 @@ public class ClassUseMapper {
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitExecutable(ExecutableElement e, Void p) {
for (TypeParameterElement param : e.getTypeParameters()) {
addParameters(param);
@ -504,13 +502,13 @@ public class ClassUseMapper {
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Void defaultAction(Element e, Void p) {
mapTypeParameters(map, e.asType(), holder);
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitTypeParameter(TypeParameterElement e, Void p) {
addParameters(e);
return null;
@ -524,7 +522,7 @@ public class ClassUseMapper {
SimpleTypeVisitor9<Void, Void> tv = new SimpleTypeVisitor9<Void, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitWildcard(WildcardType t, Void p) {
TypeMirror bound = t.getExtendsBound();
if (bound != null) {
@ -538,7 +536,7 @@ public class ClassUseMapper {
}
// ParameterizedType
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitDeclared(DeclaredType t, Void p) {
for (TypeMirror targ : t.getTypeArguments()) {
addTypeParameterToMap(map, targ, holder);
@ -566,7 +564,7 @@ public class ClassUseMapper {
}
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitPackage(PackageElement e, Void p) {
for (AnnotationMirror a : e.getAnnotationMirrors()) {
refList(map, a.getAnnotationType().asElement()).add(holder);
@ -574,7 +572,7 @@ public class ClassUseMapper {
return null;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Void defaultAction(Element e, Void p) {
addAnnotations(e);
return null;
@ -586,12 +584,12 @@ public class ClassUseMapper {
TypeMirror type, final T holder) {
new SimpleTypeVisitor9<Void, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Void defaultAction(TypeMirror e, Void p) {
return super.defaultAction(e, p);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Void visitDeclared(DeclaredType t, Void p) {
add(map, (TypeElement) t.asElement(), holder);
return null;

View File

@ -67,8 +67,6 @@ import com.sun.source.util.DocTreePath;
import com.sun.source.util.DocTrees;
import com.sun.source.util.SimpleDocTreeVisitor;
import com.sun.source.util.TreePath;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import jdk.javadoc.internal.doclets.toolkit.Configuration;
import static com.sun.source.doctree.DocTree.Kind.*;
@ -204,7 +202,7 @@ public class CommentHelper {
private StringBuilder getText0(DocTree dt) {
final StringBuilder sb = new StringBuilder();
new SimpleDocTreeVisitor<Void, Void>() {
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitAttribute(AttributeTree node, Void p) {
sb.append(SPACER).append(node.getName());
if (node.getValueKind() == ValueKind.EMPTY) {
@ -232,7 +230,7 @@ public class CommentHelper {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitEndElement(EndElementTree node, Void p) {
sb.append("</")
.append(node.getName())
@ -240,13 +238,13 @@ public class CommentHelper {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitEntity(EntityTree node, Void p) {
sb.append(node.toString());
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitLink(LinkTree node, Void p) {
if (node.getReference() == null) {
return null;
@ -259,7 +257,7 @@ public class CommentHelper {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitLiteral(LiteralTree node, Void p) {
if (node.getKind() == CODE) {
sb.append("<").append(node.getKind().tagName).append(">");
@ -271,13 +269,13 @@ public class CommentHelper {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitReference(ReferenceTree node, Void p) {
sb.append(node.getSignature());
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitSee(SeeTree node, Void p) {
node.getReference().stream().forEach((dt) -> {
dt.accept(this, null);
@ -285,7 +283,7 @@ public class CommentHelper {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitSerial(SerialTree node, Void p) {
node.getDescription().stream().forEach((dt) -> {
dt.accept(this, null);
@ -293,7 +291,7 @@ public class CommentHelper {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitStartElement(StartElementTree node, Void p) {
sb.append("<");
sb.append(node.getName());
@ -304,13 +302,13 @@ public class CommentHelper {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitText(TextTree node, Void p) {
sb.append(node.getBody());
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitUnknownBlockTag(UnknownBlockTagTree node, Void p) {
node.getContent().stream().forEach((dt) -> {
dt.accept(this, null);
@ -318,12 +316,12 @@ public class CommentHelper {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitValue(ValueTree node, Void p) {
return node.getReference().accept(this, null);
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
protected Void defaultAction(DocTree node, Void p) {
sb.append(node.toString());
return null;
@ -334,7 +332,7 @@ public class CommentHelper {
public String getLabel(Configuration c, DocTree dtree) {
return new SimpleDocTreeVisitor<String, Void>() {
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public String visitLink(LinkTree node, Void p) {
StringBuilder sb = new StringBuilder();
node.getLabel().stream().forEach((dt) -> {
@ -343,7 +341,7 @@ public class CommentHelper {
return sb.toString();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public String visitSee(SeeTree node, Void p) {
StringBuilder sb = new StringBuilder();
node.getReference().stream().filter((dt) -> (c.utils.isText(dt))).forEach((dt) -> {
@ -352,7 +350,7 @@ public class CommentHelper {
return sb.toString();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
protected String defaultAction(DocTree node, Void p) {
return "";
}
@ -429,7 +427,7 @@ public class CommentHelper {
private Element getReferencedElement(Configuration c, DocTree dtree) {
return new SimpleDocTreeVisitor<Element, Void>() {
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Element visitSee(SeeTree node, Void p) {
for (DocTree dt : node.getReference()) {
return visit(dt, null);
@ -437,27 +435,27 @@ public class CommentHelper {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Element visitLink(LinkTree node, Void p) {
return visit(node.getReference(), null);
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Element visitValue(ValueTree node, Void p) {
return visit(node.getReference(), null);
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Element visitReference(ReferenceTree node, Void p) {
return getElement(c, node);
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Element visitSerialField(SerialFieldTree node, Void p) {
return visit(node.getType(), null);
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
protected Element defaultAction(DocTree node, Void p) {
return null;
}
@ -466,7 +464,7 @@ public class CommentHelper {
public String getReferencedSignature(DocTree dtree) {
return new SimpleDocTreeVisitor<String, Void>() {
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public String visitSee(SeeTree node, Void p) {
for (DocTree dt : node.getReference()) {
return visit(dt, null);
@ -474,27 +472,27 @@ public class CommentHelper {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public String visitLink(LinkTree node, Void p) {
return visit(node.getReference(), null);
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public String visitValue(ValueTree node, Void p) {
return visit(node.getReference(), null);
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public String visitReference(ReferenceTree node, Void p) {
return node.getSignature();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public String visitSerialField(SerialFieldTree node, Void p) {
return visit(node.getType(), null);
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
protected String defaultAction(DocTree node, Void p) {
return null;
}
@ -530,87 +528,87 @@ public class CommentHelper {
return out;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitAuthor(AuthorTree node, Void p) {
return node.getName();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitComment(CommentTree node, Void p) {
return asList(node.getBody());
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitDeprecated(DeprecatedTree node, Void p) {
return node.getBody();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitDocComment(DocCommentTree node, Void p) {
return node.getBody();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitLiteral(LiteralTree node, Void p) {
return asList(node.getBody().getBody());
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitSince(SinceTree node, Void p) {
return node.getBody();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitText(TextTree node, Void p) {
return asList(node.getBody());
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitVersion(VersionTree node, Void p) {
return node.getBody();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitParam(ParamTree node, Void p) {
return node.getDescription();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitReturn(ReturnTree node, Void p) {
return node.getDescription();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitSee(SeeTree node, Void p) {
return node.getReference();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitSerial(SerialTree node, Void p) {
return node.getDescription();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitSerialData(SerialDataTree node, Void p) {
return node.getDescription();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitSerialField(SerialFieldTree node, Void p) {
return node.getDescription();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitThrows(ThrowsTree node, Void p) {
return node.getDescription();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public List<? extends DocTree> visitUnknownBlockTag(UnknownBlockTagTree node, Void p) {
return node.getContent();
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
protected List<? extends DocTree> defaultAction(DocTree node, Void p) {
return Collections.emptyList();
}

View File

@ -75,8 +75,6 @@ import com.sun.source.tree.LineMap;
import com.sun.source.util.DocSourcePositions;
import com.sun.source.util.DocTrees;
import com.sun.source.util.TreePath;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo;
import jdk.javadoc.internal.doclets.toolkit.Configuration;
import jdk.javadoc.internal.doclets.toolkit.DocletException;
@ -383,17 +381,17 @@ public class Utils {
public boolean isAnnotationType(Element e) {
return new SimpleElementVisitor9<Boolean, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitExecutable(ExecutableElement e, Void p) {
return visit(e.getEnclosingElement());
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitUnknown(Element e, Void p) {
return false;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Boolean defaultAction(Element e, Void p) {
return e.getKind() == ANNOTATION_TYPE;
}
@ -553,34 +551,34 @@ public class Utils {
}
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitTypeAsInterface(TypeElement e, SortedSet<Modifier> p) {
addVisibilityModifier(p);
addStatic(p);
return finalString("interface");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitTypeAsEnum(TypeElement e, SortedSet<Modifier> p) {
addVisibilityModifier(p);
addStatic(p);
return finalString("enum");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitTypeAsAnnotationType(TypeElement e, SortedSet<Modifier> p) {
addVisibilityModifier(p);
addStatic(p);
return finalString("@interface");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitTypeAsClass(TypeElement e, SortedSet<Modifier> p) {
addModifers(p);
return finalString("class");
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected String defaultAction(Element e, SortedSet<Modifier> p) {
addModifers(p);
return sb.toString().trim();
@ -626,19 +624,19 @@ public class Utils {
public boolean isPrimitive(TypeMirror t) {
return new SimpleTypeVisitor9<Boolean, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitNoType(NoType t, Void p) {
return t.getKind() == VOID;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitPrimitive(PrimitiveType t, Void p) {
return true;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitArray(ArrayType t, Void p) {
return visit(t.getComponentType());
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Boolean defaultAction(TypeMirror e, Void p) {
return false;
}
@ -726,7 +724,7 @@ public class Utils {
return new SimpleTypeVisitor9<StringBuilder, Void>() {
final StringBuilder sb = new StringBuilder();
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public StringBuilder visitArray(ArrayType t, Void p) {
TypeMirror componentType = t.getComponentType();
visit(componentType);
@ -734,7 +732,7 @@ public class Utils {
return sb;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public StringBuilder visitDeclared(DeclaredType t, Void p) {
Element e = t.asElement();
sb.append(qualifiedName ? getFullyQualifiedName(e) : getSimpleName(e));
@ -755,14 +753,14 @@ public class Utils {
return sb;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public StringBuilder visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
Element e = t.asElement();
sb.append(qualifiedName ? getFullyQualifiedName(e, false) : getSimpleName(e));
return sb;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public StringBuilder visitWildcard(javax.lang.model.type.WildcardType t, Void p) {
sb.append("?");
TypeMirror upperBound = t.getExtendsBound();
@ -778,7 +776,7 @@ public class Utils {
return sb;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected StringBuilder defaultAction(TypeMirror e, Void p) {
return sb.append(e);
}
@ -1176,17 +1174,17 @@ public class Utils {
public TypeElement asTypeElement(TypeMirror t) {
return new SimpleTypeVisitor9<TypeElement, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public TypeElement visitDeclared(DeclaredType t, Void p) {
return (TypeElement) t.asElement();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public TypeElement visitArray(ArrayType t, Void p) {
return visit(t.getComponentType());
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public TypeElement visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
/*
* TODO: Check with JJG.
@ -1199,17 +1197,17 @@ public class Utils {
return visit(typeUtils.erasure(t));
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public TypeElement visitWildcard(javax.lang.model.type.WildcardType t, Void p) {
return visit(typeUtils.erasure(t));
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public TypeElement visitError(ErrorType t, Void p) {
return (TypeElement)t.asElement();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected TypeElement defaultAction(TypeMirror e, Void p) {
return super.defaultAction(e, p);
}
@ -1233,13 +1231,13 @@ public class Utils {
public String getDimension(TypeMirror t) {
return new SimpleTypeVisitor9<String, Void>() {
StringBuilder dimension = new StringBuilder("");
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitArray(ArrayType t, Void p) {
dimension.append("[]");
return visit(t.getComponentType());
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected String defaultAction(TypeMirror e, Void p) {
return dimension.toString();
}
@ -1344,12 +1342,12 @@ public class Utils {
public String getTypeName(TypeMirror t, boolean fullyQualified) {
return new SimpleTypeVisitor9<String, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitArray(ArrayType t, Void p) {
return visit(t.getComponentType());
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitDeclared(DeclaredType t, Void p) {
TypeElement te = asTypeElement(t);
return fullyQualified
@ -1357,27 +1355,27 @@ public class Utils {
: getSimpleName(te);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitExecutable(ExecutableType t, Void p) {
return t.toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitPrimitive(PrimitiveType t, Void p) {
return t.toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
return getSimpleName(t.asElement());
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitWildcard(javax.lang.model.type.WildcardType t, Void p) {
return t.toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected String defaultAction(TypeMirror e, Void p) {
return e.toString();
}
@ -1840,22 +1838,22 @@ public class Utils {
*/
public String getQualifiedTypeName(TypeMirror t) {
return new SimpleTypeVisitor9<String, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitDeclared(DeclaredType t, Void p) {
return getFullyQualifiedName(t.asElement());
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitArray(ArrayType t, Void p) {
return visit(t.getComponentType());
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitPrimitive(PrimitiveType t, Void p) {
return t.toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
// The knee jerk reaction is to do this but don't!, as we would like
// it to be compatible with the old world, now if we decide to do so
@ -1864,7 +1862,7 @@ public class Utils {
return t.toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected String defaultAction(TypeMirror e, Void p) {
throw new UnsupportedOperationException("should not happen");
}
@ -1885,19 +1883,16 @@ public class Utils {
public String getFullyQualifiedName(Element e, final boolean outer) {
return new SimpleElementVisitor9<String, Void>() {
@Override
@DefinedBy(Api.LANGUAGE_MODEL)
public String visitPackage(PackageElement e, Void p) {
return e.getQualifiedName().toString();
}
@Override
@DefinedBy(Api.LANGUAGE_MODEL)
public String visitType(TypeElement e, Void p) {
return e.getQualifiedName().toString();
}
@Override
@DefinedBy(Api.LANGUAGE_MODEL)
protected String defaultAction(Element e, Void p) {
return outer ? visit(e.getEnclosingElement()) : e.getSimpleName().toString();
}
@ -2002,15 +1997,15 @@ public class Utils {
private String getTypeCode(TypeMirror t) {
return new SimpleTypeVisitor9<String, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitPrimitive(PrimitiveType t, Void p) {
return "P";
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitArray(ArrayType t, Void p) {
return visit(t.getComponentType());
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected String defaultAction(TypeMirror e, Void p) {
return "R";
}
@ -2049,12 +2044,12 @@ public class Utils {
}
boolean hasParameters(Element e) {
return new SimpleElementVisitor9<Boolean, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitExecutable(ExecutableElement e, Void p) {
return true;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Boolean defaultAction(Element e, Void p) {
return false;
}
@ -2072,29 +2067,29 @@ public class Utils {
*/
private String getFullyQualifiedName(Element e) {
return new SimpleElementVisitor9<String, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitModule(ModuleElement e, Void p) {
return e.getQualifiedName().toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitPackage(PackageElement e, Void p) {
return e.getQualifiedName().toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitExecutable(ExecutableElement e, Void p) {
// For backward compatibility
return getFullyQualifiedName(e.getEnclosingElement())
+ "." + e.getSimpleName().toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitType(TypeElement e, Void p) {
return e.getQualifiedName().toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected String defaultAction(Element e, Void p) {
return getEnclosingTypeElement(e).getQualifiedName().toString()
+ "." + e.getSimpleName().toString();
@ -2334,13 +2329,13 @@ public class Utils {
return elements;
return new SimpleElementVisitor9<List<Element>, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public List<Element> visitPackage(PackageElement e, Void p) {
recursiveGetItems(elements, e, filter, select);
return elements;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected List<Element> defaultAction(Element e0, Void p) {
return getItems0(e0, filter, select);
}
@ -2402,12 +2397,12 @@ public class Utils {
private String getSimpleName0(Element e) {
if (snvisitor == null) {
snvisitor = new SimpleElementVisitor9<String, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitModule(ModuleElement e, Void p) {
return e.getSimpleName().toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitType(TypeElement e, Void p) {
StringBuilder sb = new StringBuilder(e.getSimpleName());
Element enclosed = e.getEnclosingElement();
@ -2419,7 +2414,7 @@ public class Utils {
return sb.toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitExecutable(ExecutableElement e, Void p) {
if (e.getKind() == CONSTRUCTOR || e.getKind() == STATIC_INIT) {
return e.getEnclosingElement().getSimpleName().toString();
@ -2427,7 +2422,7 @@ public class Utils {
return e.getSimpleName().toString();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected String defaultAction(Element e, Void p) {
return e.getSimpleName().toString();
}
@ -2472,27 +2467,27 @@ public class Utils {
* and we should fix this by using getConstantValue and the visitor to
* address this in the future.
*/
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitPrimitiveAsBoolean(PrimitiveType t, Object val) {
return (int)val == 0 ? "false" : "true";
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitPrimitiveAsDouble(PrimitiveType t, Object val) {
return sourceForm(((Double)val), 'd');
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitPrimitiveAsFloat(PrimitiveType t, Object val) {
return sourceForm(((Float)val).doubleValue(), 'f');
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public String visitPrimitiveAsLong(PrimitiveType t, Object val) {
return val + "L";
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected String defaultAction(TypeMirror e, Object val) {
if (val == null)
return null;
@ -2585,22 +2580,22 @@ public class Utils {
public boolean isSpecified(Element e) {
if (specifiedVisitor == null) {
specifiedVisitor = new SimpleElementVisitor9<Boolean, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitModule(ModuleElement e, Void p) {
return configuration.getSpecifiedModules().contains(e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitPackage(PackageElement e, Void p) {
return configuration.getSpecifiedPackages().contains(e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitType(TypeElement e, Void p) {
return configuration.getSpecifiedClasses().contains(e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Boolean defaultAction(Element e, Void p) {
return false;
}

View File

@ -42,8 +42,6 @@ import javax.lang.model.util.SimpleTypeVisitor9;
import jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
/**
* A factory that constructs links from given link information.
@ -80,14 +78,14 @@ public abstract class LinkFactory {
Content link = newContent();
// handles primitives, no types and error types
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
protected Content defaultAction(TypeMirror type, LinkInfo linkInfo) {
link.addContent(utils.getTypeName(type, false));
return link;
}
int currentDepth = 0;
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Content visitArray(ArrayType type, LinkInfo linkInfo) {
// keep track of the dimension depth and replace the last dimension
// specifier with vararags, when the stack is fully unwound.
@ -109,7 +107,7 @@ public abstract class LinkFactory {
return link;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Content visitWildcard(WildcardType type, LinkInfo linkInfo) {
linkInfo.isTypeBound = true;
link.addContent("?");
@ -128,7 +126,7 @@ public abstract class LinkFactory {
return link;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Content visitTypeVariable(TypeVariable type, LinkInfo linkInfo) {
link.addContent(getTypeAnnotationLinks(linkInfo));
linkInfo.isTypeBound = true;
@ -169,7 +167,7 @@ public abstract class LinkFactory {
return link;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Content visitDeclared(DeclaredType type, LinkInfo linkInfo) {
if (linkInfo.isTypeBound && linkInfo.excludeTypeBoundsLinks) {
// Since we are excluding type parameter links, we should not

View File

@ -68,8 +68,6 @@ import com.sun.tools.javac.comp.Modules;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Names;
@ -874,22 +872,22 @@ public class ElementsTable {
if (shouldDocumentVisitor == null) {
shouldDocumentVisitor = new SimpleElementVisitor9<Boolean, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitType(TypeElement e, Void p) {
return shouldDocument((ClassSymbol) e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitVariable(VariableElement e, Void p) {
return shouldDocument((VarSymbol) e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitExecutable(ExecutableElement e, Void p) {
return shouldDocument((MethodSymbol) e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitPackage(PackageElement e, Void p) {
return accessFilter.checkModifier(e);
}
@ -947,19 +945,19 @@ public class ElementsTable {
includedCache = new LinkedHashSet<>();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitModule(ModuleElement e, Void p) {
// deduced by specified and/or requires expansion
return includedModuleElements.contains(e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitPackage(PackageElement e, Void p) {
// deduced by specified or downward expansions
return includedPackageElements.contains(e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitType(TypeElement e, Void p) {
if (includedTypeElements.contains(e)) {
return true;
@ -988,7 +986,7 @@ public class ElementsTable {
}
// members
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean defaultAction(Element e, Void p) {
if (includedCache.contains(e))
return true;
@ -1006,7 +1004,7 @@ public class ElementsTable {
return false;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@Override
public Boolean visitUnknown(Element e, Void p) {
throw new AssertionError("unknown element: " + e);
}

View File

@ -68,8 +68,6 @@ import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import com.sun.tools.classfile.*;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
/**
* "Main" class for javap, normally accessed from the command line
@ -411,7 +409,6 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
private DiagnosticListener<JavaFileObject> getDiagnosticListenerForWriter(Writer w) {
final PrintWriter pw = getPrintWriterForWriter(w);
return new DiagnosticListener<JavaFileObject> () {
@DefinedBy(Api.COMPILER)
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
switch (diagnostic.getKind()) {
case ERROR:
@ -727,67 +724,54 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
final URLConnection conn = url.openConnection();
conn.setUseCaches(false);
return new JavaFileObject() {
@DefinedBy(Api.COMPILER)
public Kind getKind() {
return JavaFileObject.Kind.CLASS;
}
@DefinedBy(Api.COMPILER)
public boolean isNameCompatible(String simpleName, Kind kind) {
throw new UnsupportedOperationException();
}
@DefinedBy(Api.COMPILER)
public NestingKind getNestingKind() {
throw new UnsupportedOperationException();
}
@DefinedBy(Api.COMPILER)
public Modifier getAccessLevel() {
throw new UnsupportedOperationException();
}
@DefinedBy(Api.COMPILER)
public URI toUri() {
return uri;
}
@DefinedBy(Api.COMPILER)
public String getName() {
return uri.toString();
}
@DefinedBy(Api.COMPILER)
public InputStream openInputStream() throws IOException {
return conn.getInputStream();
}
@DefinedBy(Api.COMPILER)
public OutputStream openOutputStream() throws IOException {
throw new UnsupportedOperationException();
}
@DefinedBy(Api.COMPILER)
public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
throw new UnsupportedOperationException();
}
@DefinedBy(Api.COMPILER)
public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
throw new UnsupportedOperationException();
}
@DefinedBy(Api.COMPILER)
public Writer openWriter() throws IOException {
throw new UnsupportedOperationException();
}
@DefinedBy(Api.COMPILER)
public long getLastModified() {
return conn.getLastModified();
}
@DefinedBy(Api.COMPILER)
public boolean delete() {
throw new UnsupportedOperationException();
}
@ -1015,47 +999,38 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
private Diagnostic<JavaFileObject> createDiagnostic(
final Diagnostic.Kind kind, final String key, final Object... args) {
return new Diagnostic<JavaFileObject>() {
@DefinedBy(Api.COMPILER)
public Kind getKind() {
return kind;
}
@DefinedBy(Api.COMPILER)
public JavaFileObject getSource() {
return null;
}
@DefinedBy(Api.COMPILER)
public long getPosition() {
return Diagnostic.NOPOS;
}
@DefinedBy(Api.COMPILER)
public long getStartPosition() {
return Diagnostic.NOPOS;
}
@DefinedBy(Api.COMPILER)
public long getEndPosition() {
return Diagnostic.NOPOS;
}
@DefinedBy(Api.COMPILER)
public long getLineNumber() {
return Diagnostic.NOPOS;
}
@DefinedBy(Api.COMPILER)
public long getColumnNumber() {
return Diagnostic.NOPOS;
}
@DefinedBy(Api.COMPILER)
public String getCode() {
return key;
}
@DefinedBy(Api.COMPILER)
public String getMessage(Locale locale) {
return JavapTask.this.getMessage(locale, key, args);
}

View File

@ -52,8 +52,6 @@ import javax.tools.SimpleJavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_FMGR;
@ -103,7 +101,7 @@ class MemoryFileManager implements JavaFileManager {
return origin;
}
@Override @DefinedBy(Api.COMPILER)
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
return src;
}
@ -146,7 +144,7 @@ class MemoryFileManager implements JavaFileManager {
}
}
@Override @DefinedBy(Api.COMPILER)
@Override
public String getName() {
return className;
}
@ -155,12 +153,12 @@ class MemoryFileManager implements JavaFileManager {
* Will provide the compiler with an output stream that leads to our
* byte array.
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public OutputStream openOutputStream() throws IOException {
return bos;
}
@Override @DefinedBy(Api.COMPILER)
@Override
public InputStream openInputStream() throws IOException {
return new ByteArrayInputStream(getBytes());
}
@ -187,7 +185,6 @@ class MemoryFileManager implements JavaFileManager {
}
// Make compatible with Jigsaw
@DefinedBy(Api.COMPILER)
public String inferModuleName(Location location) {
try {
if (inferModuleNameMethod == null) {
@ -206,7 +203,6 @@ class MemoryFileManager implements JavaFileManager {
}
// Make compatible with Jigsaw
@DefinedBy(Api.COMPILER)
public Iterable<Set<Location>> listModuleLocations(Location location) throws IOException {
try {
if (listModuleLocationsMethod == null) {
@ -241,7 +237,7 @@ class MemoryFileManager implements JavaFileManager {
* @throws IllegalStateException if {@link #close} has been called
* and this file manager cannot be reopened
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public ClassLoader getClassLoader(JavaFileManager.Location location) {
proc.debug(DBG_FMGR, "getClassLoader: location\n", location);
return stdFileManager.getClassLoader(location);
@ -267,7 +263,7 @@ class MemoryFileManager implements JavaFileManager {
* @throws IllegalStateException if {@link #close} has been called
* and this file manager cannot be reopened
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public Iterable<JavaFileObject> list(JavaFileManager.Location location,
String packageName,
Set<JavaFileObject.Kind> kinds,
@ -324,7 +320,7 @@ class MemoryFileManager implements JavaFileManager {
* @throws IllegalStateException if {@link #close} has been called
* and this file manager cannot be reopened
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public String inferBinaryName(JavaFileManager.Location location, JavaFileObject file) {
if (file instanceof OutputMemoryJavaFileObject) {
OutputMemoryJavaFileObject ofo = (OutputMemoryJavaFileObject) file;
@ -348,7 +344,7 @@ class MemoryFileManager implements JavaFileManager {
* were created with another file manager and this file manager
* does not support foreign file objects
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public boolean isSameFile(FileObject a, FileObject b) {
return stdFileManager.isSameFile(b, b);
}
@ -361,7 +357,7 @@ class MemoryFileManager implements JavaFileManager {
* @return the number of arguments the given option takes or -1 if
* the option is not supported
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public int isSupportedOption(String option) {
proc.debug(DBG_FMGR, "isSupportedOption: %s\n", option);
return stdFileManager.isSupportedOption(option);
@ -381,7 +377,7 @@ class MemoryFileManager implements JavaFileManager {
* @throws IllegalStateException if {@link #close} has been called
* and this file manager cannot be reopened
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public boolean handleOption(String current, Iterator<String> remaining) {
proc.debug(DBG_FMGR, "handleOption: current: %s\n", current +
", remaining: " + remaining);
@ -394,7 +390,7 @@ class MemoryFileManager implements JavaFileManager {
* @param location a location
* @return true if the location is known
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public boolean hasLocation(JavaFileManager.Location location) {
proc.debug(DBG_FMGR, "hasLocation: location: %s\n", location);
return stdFileManager.hasLocation(location);
@ -430,7 +426,7 @@ class MemoryFileManager implements JavaFileManager {
* @throws IllegalStateException if {@link #close} has been called
* and this file manager cannot be reopened
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public JavaFileObject getJavaFileForInput(JavaFileManager.Location location,
String className,
JavaFileObject.Kind kind)
@ -470,7 +466,7 @@ class MemoryFileManager implements JavaFileManager {
* @throws IllegalStateException {@link #close} has been called
* and this file manager cannot be reopened
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location,
String className, Kind kind, FileObject sibling) throws IOException {
@ -523,7 +519,7 @@ class MemoryFileManager implements JavaFileManager {
* @throws IllegalStateException if {@link #close} has been called
* and this file manager cannot be reopened
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public FileObject getFileForInput(JavaFileManager.Location location,
String packageName,
String relativeName)
@ -572,7 +568,7 @@ class MemoryFileManager implements JavaFileManager {
* @throws IllegalStateException if {@link #close} has been called
* and this file manager cannot be reopened
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public FileObject getFileForOutput(JavaFileManager.Location location,
String packageName,
String relativeName,
@ -592,7 +588,7 @@ class MemoryFileManager implements JavaFileManager {
* @throws IOException if an I/O error occurred
* @see #close
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public void flush() throws IOException {
// Nothing to flush
}
@ -608,7 +604,7 @@ class MemoryFileManager implements JavaFileManager {
* @throws IOException if an I/O error occurred
* @see #flush
*/
@Override @DefinedBy(Api.COMPILER)
@Override
public void close() throws IOException {
// Nothing to close
}

View File

@ -55,8 +55,6 @@ import com.sun.tools.javac.code.Symbol.VarSymbol;
import com.sun.tools.javac.code.Symtab;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Type.ClassType;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Names;
import com.sun.tools.javac.util.Pair;
@ -534,7 +532,7 @@ class SourceCodeAnalysisImpl extends SourceCodeAnalysis {
TreePath[] deepest = new TreePath[1];
new TreePathScanner<Void, Void>() {
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void scan(Tree tree, Void p) {
if (tree == null)
return null;
@ -552,7 +550,7 @@ class SourceCodeAnalysisImpl extends SourceCodeAnalysis {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitErroneous(ErroneousTree node, Void p) {
return scan(node.getErrorTrees(), null);
}
@ -1250,7 +1248,7 @@ class SourceCodeAnalysisImpl extends SourceCodeAnalysis {
Trees trees = Trees.instance(source.fst);
new TreePathScanner<Void, Void>() {
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitMethod(MethodTree node, Void p) {
Element currentMethod = trees.getElement(getCurrentPath());

View File

@ -34,8 +34,6 @@ import com.sun.source.tree.PackageTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.VariableTree;
import com.sun.source.util.TreeScanner;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@ -67,7 +65,7 @@ class TreeDependencyScanner extends TreeScanner<Void, Set<String>> {
// -- Differentiate declaration references from body references ---
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitClass(ClassTree node, Set<String> p) {
scan(node.getModifiers(), p);
scan(node.getTypeParameters(), p);
@ -77,7 +75,7 @@ class TreeDependencyScanner extends TreeScanner<Void, Set<String>> {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitMethod(MethodTree node, Set<String> p) {
scan(node.getModifiers(), p);
scan(node.getReturnType(), p);
@ -90,7 +88,7 @@ class TreeDependencyScanner extends TreeScanner<Void, Set<String>> {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitVariable(VariableTree node, Set<String> p) {
scan(node.getModifiers(), p);
scan(node.getType(), p);
@ -101,12 +99,12 @@ class TreeDependencyScanner extends TreeScanner<Void, Set<String>> {
// --- Ignore these ---
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitPackage(PackageTree node, Set<String> p) {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitImport(ImportTree node, Set<String> p) {
return null;
}
@ -114,13 +112,13 @@ class TreeDependencyScanner extends TreeScanner<Void, Set<String>> {
// -- Actual Symbol names ---
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitMemberSelect(MemberSelectTree node, Set<String> p) {
add(p, node.getIdentifier());
return super.visitMemberSelect(node, p);
}
@Override @DefinedBy(Api.COMPILER_TREE)
@Override
public Void visitIdentifier(IdentifierTree node, Set<String> p) {
add(p, node.getName());
return super.visitIdentifier(node, p);

View File

@ -82,6 +82,5 @@ tools/sjavac/ClasspathDependencies.java 8158002 generic-all Requires i
#
# jdeprscan
tools/all/RunCodingRules.java 8164836 generic-all fix @DefinedBy
tools/jdeprscan/tests/jdk/jdeprscan/TestLoad.java 8164837 windows-all probably line breaks or encoding
tools/jdeprscan/tests/jdk/jdeprscan/TestScan.java 8164837 windows-all probably line breaks or encoding