--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -33,8 +33,10 @@
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.doclint.DocLint;
import com.sun.tools.javac.file.JavacFileManager;
import com.sun.tools.javac.util.Context;
+import com.sun.tools.javadoc.RootDocImpl;
/**
* Configure the output based on the command line options.
@@ -172,6 +174,11 @@
public boolean createoverview = false;
/**
+ * Collected set of doclint options
+ */
+ public Set<String> doclintOpts = new LinkedHashSet<String>();
+
+ /**
* Unique Resource Handler for this package.
*/
public final MessageRetriever standardmessage;
@@ -255,6 +262,10 @@
nooverview = true;
} else if (opt.equals("-overview")) {
overview = true;
+ } else if (opt.equals("-xdoclint")) {
+ doclintOpts.add(null);
+ } else if (opt.startsWith("-xdoclint:")) {
+ doclintOpts.add(opt.substring(opt.indexOf(":") + 1));
}
}
if (root.specifiedClasses().length > 0) {
@@ -270,6 +281,10 @@
}
setCreateOverview();
setTopFile(root);
+
+ if (root instanceof RootDocImpl) {
+ ((RootDocImpl) root).initDocLint(doclintOpts);
+ }
}
/**
@@ -303,7 +318,9 @@
option.equals("-serialwarn") ||
option.equals("-use") ||
option.equals("-nonavbar") ||
- option.equals("-nooverview")) {
+ option.equals("-nooverview") ||
+ option.equals("-xdoclint") ||
+ option.startsWith("-xdoclint:")) {
return 1;
} else if (option.equals("-help")) {
System.out.println(getText("doclet.usage"));
@@ -410,6 +427,16 @@
return false;
}
noindex = true;
+ } else if (opt.startsWith("-xdoclint:")) {
+ if (opt.contains("/")) {
+ reporter.printError(getText("doclet.Option_doclint_no_qualifiers"));
+ return false;
+ }
+ if (!DocLint.isValidOption(
+ opt.replace("-xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX))) {
+ reporter.printError(getText("doclet.Option_doclint_invalid_arg"));
+ return false;
+ }
}
}
return true;
@@ -506,8 +533,8 @@
*/
@Override
public Locale getLocale() {
- if (root instanceof com.sun.tools.javadoc.RootDocImpl)
- return ((com.sun.tools.javadoc.RootDocImpl)root).getLocale();
+ if (root instanceof RootDocImpl)
+ return ((RootDocImpl)root).getLocale();
else
return Locale.getDefault();
}
@@ -518,8 +545,8 @@
@Override
public JavaFileManager getFileManager() {
if (fileManager == null) {
- if (root instanceof com.sun.tools.javadoc.RootDocImpl)
- fileManager = ((com.sun.tools.javadoc.RootDocImpl)root).getFileManager();
+ if (root instanceof RootDocImpl)
+ fileManager = ((RootDocImpl) root).getFileManager();
else
fileManager = new JavacFileManager(new Context(), false, null);
}
@@ -527,4 +554,12 @@
}
private JavaFileManager fileManager;
+
+ @Override
+ public boolean showMessage(SourcePosition pos, String key) {
+ if (root instanceof RootDocImpl) {
+ return pos == null || ((RootDocImpl) root).showTagMessages();
+ }
+ return true;
+ }
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -781,4 +781,6 @@
sourcetab = n;
tabSpaces = String.format("%" + n + "s", "");
}
+
+ public abstract boolean showMessage(SourcePosition pos, String key);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties Wed Jan 16 12:14:29 2013 -0800
@@ -11,6 +11,8 @@
doclet.Class_0_extends_implements_serializable=Class {0} extends {1} implements Serializable
doclet.Option_conflict=Option {0} conflicts with {1}
doclet.Option_reuse=Option reused: {0}
+doclet.Option_doclint_no_qualifiers=Access qualifiers not permitted for -Xdoclint arguments
+doclet.Option_doclint_invalid_arg=Invalid argument for -Xdoclint option
doclet.exception_encountered= {0} encountered \n\
\twhile attempting to create file: {1}
doclet.perform_copy_exception_encountered= {0} encountered while \n\
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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,9 +60,9 @@
private ResourceBundle messageRB;
/**
- * Initilize the ResourceBundle with the given resource.
+ * Initialize the ResourceBundle with the given resource.
*
- * @param rb the esource bundle to read.
+ * @param rb the resource bundle to read.
*/
public MessageRetriever(ResourceBundle rb) {
this.configuration = null;
@@ -71,7 +71,7 @@
}
/**
- * Initilize the ResourceBundle with the given resource.
+ * Initialize the ResourceBundle with the given resource.
*
* @param configuration the configuration
* @param resourcelocation Resource.
@@ -189,7 +189,8 @@
* @param args arguments to be replaced in the message.
*/
public void warning(SourcePosition pos, String key, Object... args) {
- printWarning(pos, getText(key, args));
+ if (configuration.showMessage(pos, key))
+ printWarning(pos, getText(key, args));
}
/**
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
package com.sun.tools.doclint;
+import com.sun.source.doctree.LiteralTree;
import java.util.regex.Matcher;
import com.sun.source.doctree.LinkTree;
import java.net.URI;
@@ -359,9 +360,8 @@
env.messages.error(HTML, tree, "dc.tag.unknown", treeName);
} else if (t.endKind == HtmlTag.EndKind.NONE) {
env.messages.error(HTML, tree, "dc.tag.end.not.permitted", treeName);
- } else if (tagStack.isEmpty()) {
- env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
} else {
+ boolean done = false;
while (!tagStack.isEmpty()) {
TagStackItem top = tagStack.peek();
if (t == top.tag) {
@@ -383,6 +383,7 @@
env.messages.error(HTML, tree, "dc.text.not.allowed", treeName);
}
tagStack.pop();
+ done = true;
break;
} else if (top.tag == null || top.tag.endKind != HtmlTag.EndKind.REQUIRED) {
tagStack.pop();
@@ -400,10 +401,15 @@
tagStack.pop();
} else {
env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
+ done = true;
break;
}
}
}
+
+ if (!done && tagStack.isEmpty()) {
+ env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
+ }
}
return super.visitEndElement(tree, ignore);
@@ -447,14 +453,18 @@
if (currTag != HtmlTag.A) {
break;
}
- // fallthrough
+ // fallthrough
case ID:
String value = getAttrValue(tree);
- if (!validName.matcher(value).matches()) {
- env.messages.error(HTML, tree, "dc.invalid.anchor", value);
- }
- if (!foundAnchors.add(value)) {
- env.messages.error(HTML, tree, "dc.anchor.already.defined", value);
+ if (value == null) {
+ env.messages.error(HTML, tree, "dc.anchor.value.missing");
+ } else {
+ if (!validName.matcher(value).matches()) {
+ env.messages.error(HTML, tree, "dc.invalid.anchor", value);
+ }
+ if (!foundAnchors.add(value)) {
+ env.messages.error(HTML, tree, "dc.anchor.already.defined", value);
+ }
}
break;
@@ -542,6 +552,19 @@
}
@Override
+ public Void visitLiteral(LiteralTree tree, Void ignore) {
+ if (tree.getKind() == DocTree.Kind.CODE) {
+ for (TagStackItem tsi: tagStack) {
+ if (tsi.tag == HtmlTag.CODE) {
+ env.messages.warning(HTML, tree, "dc.tag.nested.not.allowed", "code");
+ break;
+ }
+ }
+ }
+ return super.visitLiteral(tree, ignore);
+ }
+
+ @Override
public Void visitParam(ParamTree tree, Void ignore) {
boolean typaram = tree.isTypeParameter();
IdentifierTree nameTree = tree.getName();
--- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2013, 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
@@ -24,6 +24,7 @@
#
dc.anchor.already.defined = anchor already defined: {0}
+dc.anchor.value.missing = no value given for anchor
dc.attr.lacks.value = attribute lacks value
dc.attr.obsolete = attribute obsolete: {0}
dc.attr.obsolete.use.css = attribute obsolete, use CSS instead: {0}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Annotations.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Annotations.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -126,12 +126,12 @@
//
// We need to do this in two passes because when creating
// a container for a repeating annotation we must
- // guarantee that the @ContainedBy on the
+ // guarantee that the @Repeatable on the
// contained annotation is fully annotated
//
// The way we force this order is to do all repeating
// annotations in a pass after all non-repeating are
- // finished. This will work because @ContainedBy
+ // finished. This will work because @Repeatable
// is non-repeating and therefore will be annotated in the
// fist pass.
@@ -261,7 +261,7 @@
// its contained annotation.
ListBuffer<Attribute.Compound> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
if (manualContainer != null) {
- log.error(ctx.pos.get(manualContainer.first()), "invalid.containedby.annotation.repeated.and.container.present",
+ log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present",
manualContainer.first().type.tsym);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -450,7 +450,7 @@
* This is the implementation for {@code
* javax.lang.model.element.Element.getAnnotationMirrors()}.
*/
- public final List<Attribute.Compound> getAnnotationMirrors() {
+ public final List<? extends AnnotationMirror> getAnnotationMirrors() {
return getRawAttributes();
}
@@ -462,6 +462,11 @@
return JavacElements.getAnnotation(this, annoType);
}
+ // This method is part of the javax.lang.model API, do not use this in javac code.
+ public <A extends java.lang.annotation.Annotation> A[] getAnnotations(Class<A> annoType) {
+ return JavacElements.getAnnotations(this, annoType);
+ }
+
// TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList
public java.util.List<Symbol> getEnclosedElements() {
return List.nil();
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -161,10 +161,10 @@
public final Type autoCloseableType;
public final Type trustMeType;
public final Type lambdaMetafactory;
- public final Type containedByType;
- public final Type containerForType;
+ public final Type repeatableType;
public final Type documentedType;
public final Type elementTypeType;
+ public final Type functionalInterfaceType;
/** The symbol representing the length field of an array.
*/
@@ -494,8 +494,7 @@
deprecatedType = enterClass("java.lang.Deprecated");
suppressWarningsType = enterClass("java.lang.SuppressWarnings");
inheritedType = enterClass("java.lang.annotation.Inherited");
- containedByType = enterClass("java.lang.annotation.ContainedBy");
- containerForType = enterClass("java.lang.annotation.ContainerFor");
+ repeatableType = enterClass("java.lang.annotation.Repeatable");
documentedType = enterClass("java.lang.annotation.Documented");
elementTypeType = enterClass("java.lang.annotation.ElementType");
systemType = enterClass("java.lang.System");
@@ -509,6 +508,7 @@
nativeHeaderType = enterClass("java.lang.annotation.Native");
nativeHeaderType_old = enterClass("javax.tools.annotation.GenerateNativeHeader");
lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
+ functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
synthesizeEmptyInterfaceIfMissing(autoCloseableType);
synthesizeEmptyInterfaceIfMissing(cloneableType);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jan 16 12:14:29 2013 -0800
@@ -392,9 +392,9 @@
* Compute the function descriptor associated with a given functional interface
*/
public FunctionDescriptor findDescriptorInternal(TypeSymbol origin, CompoundScope membersCache) throws FunctionDescriptorLookupError {
- if (!origin.isInterface()) {
+ if (!origin.isInterface() || (origin.flags() & ANNOTATION) != 0) {
//t must be an interface
- throw failure("not.a.functional.intf");
+ throw failure("not.a.functional.intf", origin);
}
final ListBuffer<Symbol> abstracts = ListBuffer.lb();
@@ -406,13 +406,13 @@
abstracts.append(sym);
} else {
//the target method(s) should be the only abstract members of t
- throw failure("not.a.functional.intf.1",
+ throw failure("not.a.functional.intf.1", origin,
diags.fragment("incompatible.abstracts", Kinds.kindName(origin), origin));
}
}
if (abstracts.isEmpty()) {
//t must define a suitable non-generic method
- throw failure("not.a.functional.intf.1",
+ throw failure("not.a.functional.intf.1", origin,
diags.fragment("no.abstracts", Kinds.kindName(origin), origin));
} else if (abstracts.size() == 1) {
return new FunctionDescriptor(abstracts.first());
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -392,7 +392,7 @@
List.of(p)));
if (!chk.annotationApplicable(annoTree, on))
- log.error(annoTree.pos(), "invalid.containedby.annotation.incompatible.target", targetContainerType, origAnnoType);
+ log.error(annoTree.pos(), "invalid.repeatable.annotation.incompatible.target", targetContainerType, origAnnoType);
if (!chk.validateAnnotationDeferErrors(annoTree))
log.error(annoTree.pos(), "duplicate.annotation.invalid.repeated", origAnnoType);
@@ -414,11 +414,11 @@
Type origAnnoType = currentAnno.type;
TypeSymbol origAnnoDecl = origAnnoType.tsym;
- // Fetch the ContainedBy annotation from the current
+ // Fetch the Repeatable annotation from the current
// annotation's declaration, or null if it has none
- Attribute.Compound ca = origAnnoDecl.attribute(syms.containedByType.tsym);
- if (ca == null) { // has no ContainedBy annotation
- log.error(pos, "duplicate.annotation.missing.container", origAnnoType, syms.containedByType);
+ Attribute.Compound ca = origAnnoDecl.attribute(syms.repeatableType.tsym);
+ if (ca == null) { // has no Repeatable annotation
+ log.error(pos, "duplicate.annotation.missing.container", origAnnoType, syms.repeatableType);
return null;
}
@@ -440,23 +440,23 @@
DiagnosticPosition pos,
TypeSymbol annoDecl)
{
- // The next three checks check that the ContainedBy annotation
+ // The next three checks check that the Repeatable annotation
// on the declaration of the annotation type that is repeating is
// valid.
- // ContainedBy must have at least one element
+ // Repeatable must have at least one element
if (ca.values.isEmpty()) {
- log.error(pos, "invalid.containedby.annotation", annoDecl);
+ log.error(pos, "invalid.repeatable.annotation", annoDecl);
return null;
}
Pair<MethodSymbol,Attribute> p = ca.values.head;
Name name = p.fst.name;
if (name != names.value) { // should contain only one element, named "value"
- log.error(pos, "invalid.containedby.annotation", annoDecl);
+ log.error(pos, "invalid.repeatable.annotation", annoDecl);
return null;
}
if (!(p.snd instanceof Attribute.Class)) { // check that the value of "value" is an Attribute.Class
- log.error(pos, "invalid.containedby.annotation", annoDecl);
+ log.error(pos, "invalid.repeatable.annotation", annoDecl);
return null;
}
@@ -491,13 +491,13 @@
}
if (error) {
log.error(pos,
- "invalid.containedby.annotation.multiple.values",
+ "invalid.repeatable.annotation.multiple.values",
targetContainerType,
nr_value_elems);
return null;
} else if (nr_value_elems == 0) {
log.error(pos,
- "invalid.containedby.annotation.no.value",
+ "invalid.repeatable.annotation.no.value",
targetContainerType);
return null;
}
@@ -506,7 +506,7 @@
// probably "impossible" to fail this
if (containerValueSymbol.kind != Kinds.MTH) {
log.error(pos,
- "invalid.containedby.annotation.invalid.value",
+ "invalid.repeatable.annotation.invalid.value",
targetContainerType);
fatalError = true;
}
@@ -518,7 +518,7 @@
if (!(types.isArray(valueRetType) &&
types.isSameType(expectedType, valueRetType))) {
log.error(pos,
- "invalid.containedby.annotation.value.return",
+ "invalid.repeatable.annotation.value.return",
targetContainerType,
valueRetType,
expectedType);
@@ -528,10 +528,7 @@
fatalError = true;
}
- // Explicitly no check for/validity of @ContainerFor. That is
- // done on declaration of the container, and at reflect time.
-
- // The rest of the conditions for a valid containing annotation are made
+ // The conditions for a valid containing annotation are made
// in Check.validateRepeatedAnnotaton();
return fatalError ? null : containerValueSymbol;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -3844,24 +3844,14 @@
log.error(tree.typarams.head.pos(),
"intf.annotation.cant.have.type.params");
- // If this annotation has a @ContainedBy, validate
- Attribute.Compound containedBy = c.attribute(syms.containedByType.tsym);
- if (containedBy != null) {
- // get diagnositc position for error reporting
- DiagnosticPosition cbPos = getDiagnosticPosition(tree, containedBy.type);
+ // If this annotation has a @Repeatable, validate
+ Attribute.Compound repeatable = c.attribute(syms.repeatableType.tsym);
+ if (repeatable != null) {
+ // get diagnostic position for error reporting
+ DiagnosticPosition cbPos = getDiagnosticPosition(tree, repeatable.type);
Assert.checkNonNull(cbPos);
- chk.validateContainedBy(c, containedBy, cbPos);
- }
-
- // If this annotation has a @ContainerFor, validate
- Attribute.Compound containerFor = c.attribute(syms.containerForType.tsym);
- if (containerFor != null) {
- // get diagnositc position for error reporting
- DiagnosticPosition cfPos = getDiagnosticPosition(tree, containerFor.type);
- Assert.checkNonNull(cfPos);
-
- chk.validateContainerFor(c, containerFor, cfPos);
+ chk.validateRepeatable(c, repeatable, cbPos);
}
} else {
// Check that all extended classes and interfaces
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -634,25 +634,40 @@
}
}
+ Type checkClassOrArrayType(DiagnosticPosition pos, Type t) {
+ if (!t.hasTag(CLASS) && !t.hasTag(ARRAY) && !t.hasTag(ERROR)) {
+ return typeTagError(pos,
+ diags.fragment("type.req.class.array"),
+ asTypeParam(t));
+ } else {
+ return t;
+ }
+ }
+
/** Check that type is a class or interface type.
* @param pos Position to be used for error reporting.
* @param t The type to be checked.
*/
Type checkClassType(DiagnosticPosition pos, Type t) {
- if (!t.hasTag(CLASS) && !t.hasTag(ERROR))
+ if (!t.hasTag(CLASS) && !t.hasTag(ERROR)) {
return typeTagError(pos,
diags.fragment("type.req.class"),
- (t.hasTag(TYPEVAR))
- ? diags.fragment("type.parameter", t)
- : t);
- else
+ asTypeParam(t));
+ } else {
return t;
+ }
}
+ //where
+ private Object asTypeParam(Type t) {
+ return (t.hasTag(TYPEVAR))
+ ? diags.fragment("type.parameter", t)
+ : t;
+ }
/** Check that type is a valid qualifier for a constructor reference expression
*/
Type checkConstructorRefType(DiagnosticPosition pos, Type t) {
- t = checkClassType(pos, t);
+ t = checkClassOrArrayType(pos, t);
if (t.hasTag(CLASS)) {
if ((t.tsym.flags() & (ABSTRACT | INTERFACE)) != 0) {
log.error(pos, "abstract.cant.be.instantiated");
@@ -690,11 +705,8 @@
* @param t The type to be checked.
*/
Type checkReifiableReferenceType(DiagnosticPosition pos, Type t) {
- if (!t.hasTag(CLASS) && !t.hasTag(ARRAY) && !t.hasTag(ERROR)) {
- return typeTagError(pos,
- diags.fragment("type.req.class.array"),
- t);
- } else if (!types.isReifiable(t)) {
+ t = checkClassOrArrayType(pos, t);
+ if (!t.isErroneous() && !types.isReifiable(t)) {
log.error(pos, "illegal.generic.type.for.instof");
return types.createErrorType(t);
} else {
@@ -2589,33 +2601,45 @@
if (!isOverrider(s))
log.error(a.pos(), "method.does.not.override.superclass");
}
+
+ if (a.annotationType.type.tsym == syms.functionalInterfaceType.tsym) {
+ if (s.kind != TYP) {
+ log.error(a.pos(), "bad.functional.intf.anno");
+ } else {
+ try {
+ types.findDescriptorSymbol((TypeSymbol)s);
+ } catch (Types.FunctionDescriptorLookupError ex) {
+ log.error(a.pos(), "bad.functional.intf.anno.1", ex.getDiagnostic());
+ }
+ }
+ }
}
/**
- * Validate the proposed container 'containedBy' on the
+ * Validate the proposed container 'repeatable' on the
* annotation type symbol 's'. Report errors at position
* 'pos'.
*
- * @param s The (annotation)type declaration annotated with a @ContainedBy
- * @param containedBy the @ContainedBy on 's'
+ * @param s The (annotation)type declaration annotated with a @Repeatable
+ * @param repeatable the @Repeatable on 's'
* @param pos where to report errors
*/
- public void validateContainedBy(TypeSymbol s, Attribute.Compound containedBy, DiagnosticPosition pos) {
- Assert.check(types.isSameType(containedBy.type, syms.containedByType));
+ public void validateRepeatable(TypeSymbol s, Attribute.Compound repeatable, DiagnosticPosition pos) {
+ Assert.check(types.isSameType(repeatable.type, syms.repeatableType));
Type t = null;
- List<Pair<MethodSymbol,Attribute>> l = containedBy.values;
+ List<Pair<MethodSymbol,Attribute>> l = repeatable.values;
if (!l.isEmpty()) {
Assert.check(l.head.fst.name == names.value);
t = ((Attribute.Class)l.head.snd).getValue();
}
if (t == null) {
- log.error(pos, "invalid.container.wrong.containedby", s, containedBy);
+ // errors should already have been reported during Annotate
return;
}
- validateHasContainerFor(t.tsym, s, pos);
+ validateValue(t.tsym, s, pos);
validateRetention(t.tsym, s, pos);
validateDocumented(t.tsym, s, pos);
validateInherited(t.tsym, s, pos);
@@ -2623,79 +2647,18 @@
validateDefault(t.tsym, s, pos);
}
- /**
- * Validate the proposed container 'containerFor' on the
- * annotation type symbol 's'. Report errors at position
- * 'pos'.
- *
- * @param s The (annotation)type declaration annotated with a @ContainerFor
- * @param containerFor the @ContainedFor on 's'
- * @param pos where to report errors
- */
- public void validateContainerFor(TypeSymbol s, Attribute.Compound containerFor, DiagnosticPosition pos) {
- Assert.check(types.isSameType(containerFor.type, syms.containerForType));
-
- Type t = null;
- List<Pair<MethodSymbol,Attribute>> l = containerFor.values;
- if (!l.isEmpty()) {
- Assert.check(l.head.fst.name == names.value);
- t = ((Attribute.Class)l.head.snd).getValue();
- }
-
- if (t == null) {
- log.error(pos, "invalid.container.wrong.containerfor", s, containerFor);
- return;
- }
-
- validateHasContainedBy(t.tsym, s, pos);
- }
-
- private void validateHasContainedBy(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) {
- Attribute.Compound containedBy = container.attribute(syms.containedByType.tsym);
-
- if (containedBy == null) {
- log.error(pos, "invalid.container.no.containedby", container, syms.containedByType.tsym);
- return;
+ private void validateValue(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) {
+ Scope.Entry e = container.members().lookup(names.value);
+ if (e.scope != null && e.sym.kind == MTH) {
+ MethodSymbol m = (MethodSymbol) e.sym;
+ Type ret = m.getReturnType();
+ if (!(ret.hasTag(ARRAY) && types.isSameType(((ArrayType)ret).elemtype, contained.type))) {
+ log.error(pos, "invalid.repeatable.annotation.value.return",
+ container, ret, types.makeArrayType(contained.type));
+ }
+ } else {
+ log.error(pos, "invalid.repeatable.annotation.no.value", container);
}
-
- Type t = null;
- List<Pair<MethodSymbol,Attribute>> l = containedBy.values;
- if (!l.isEmpty()) {
- Assert.check(l.head.fst.name == names.value);
- t = ((Attribute.Class)l.head.snd).getValue();
- }
-
- if (t == null) {
- log.error(pos, "invalid.container.wrong.containedby", container, contained);
- return;
- }
-
- if (!types.isSameType(t, contained.type))
- log.error(pos, "invalid.container.wrong.containedby", t.tsym, contained);
- }
-
- private void validateHasContainerFor(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) {
- Attribute.Compound containerFor = container.attribute(syms.containerForType.tsym);
-
- if (containerFor == null) {
- log.error(pos, "invalid.container.no.containerfor", container, syms.containerForType.tsym);
- return;
- }
-
- Type t = null;
- List<Pair<MethodSymbol,Attribute>> l = containerFor.values;
- if (!l.isEmpty()) {
- Assert.check(l.head.fst.name == names.value);
- t = ((Attribute.Class)l.head.snd).getValue();
- }
-
- if (t == null) {
- log.error(pos, "invalid.container.wrong.containerfor", container, contained);
- return;
- }
-
- if (!types.isSameType(t, contained.type))
- log.error(pos, "invalid.container.wrong.containerfor", t.tsym, contained);
}
private void validateRetention(Symbol container, Symbol contained, DiagnosticPosition pos) {
@@ -2715,7 +2678,7 @@
}
}
if (error ) {
- log.error(pos, "invalid.containedby.annotation.retention",
+ log.error(pos, "invalid.repeatable.annotation.retention",
container, containerRetention,
contained, containedRetention);
}
@@ -2724,7 +2687,7 @@
private void validateDocumented(Symbol container, Symbol contained, DiagnosticPosition pos) {
if (contained.attribute(syms.documentedType.tsym) != null) {
if (container.attribute(syms.documentedType.tsym) == null) {
- log.error(pos, "invalid.containedby.annotation.not.documented", container, contained);
+ log.error(pos, "invalid.repeatable.annotation.not.documented", container, contained);
}
}
}
@@ -2732,7 +2695,7 @@
private void validateInherited(Symbol container, Symbol contained, DiagnosticPosition pos) {
if (contained.attribute(syms.inheritedType.tsym) != null) {
if (container.attribute(syms.inheritedType.tsym) == null) {
- log.error(pos, "invalid.containedby.annotation.not.inherited", container, contained);
+ log.error(pos, "invalid.repeatable.annotation.not.inherited", container, contained);
}
}
}
@@ -2752,7 +2715,7 @@
// contained has target, but container has not, error
Attribute.Array containerTarget = getAttributeTargetAttribute(container);
if (containerTarget == null) {
- log.error(pos, "invalid.containedby.annotation.incompatible.target", container, contained);
+ log.error(pos, "invalid.repeatable.annotation.incompatible.target", container, contained);
return;
}
@@ -2775,7 +2738,7 @@
}
if (!isTargetSubset(containedTargets, containerTargets)) {
- log.error(pos, "invalid.containedby.annotation.incompatible.target", container, contained);
+ log.error(pos, "invalid.repeatable.annotation.incompatible.target", container, contained);
}
}
@@ -2809,7 +2772,7 @@
elm.kind == Kinds.MTH &&
((MethodSymbol)elm).defaultValue == null) {
log.error(pos,
- "invalid.containedby.annotation.elem.nondefault",
+ "invalid.repeatable.annotation.elem.nondefault",
container,
elm);
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -131,7 +131,11 @@
predefClassDef = make.ClassDef(
make.Modifiers(PUBLIC),
- syms.predefClass.name, null, null, null, null);
+ syms.predefClass.name,
+ List.<JCTypeParameter>nil(),
+ null,
+ List.<JCExpression>nil(),
+ List.<JCTree>nil());
predefClassDef.sym = syms.predefClass;
todo = Todo.instance(context);
fileManager = context.get(JavaFileManager.class);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Wed Jan 16 12:14:29 2013 -0800
@@ -302,6 +302,7 @@
case UNBOUND: /** Type :: instMethod */
case STATIC: /** Type :: staticMethod */
case TOPLEVEL: /** Top level :: new */
+ case ARRAY_CTOR: /** ArrayType :: new */
init = null;
break;
@@ -645,24 +646,33 @@
* to the first bridge synthetic parameter
*/
private JCExpression bridgeExpressionNew() {
- JCExpression encl = null;
- switch (tree.kind) {
- case UNBOUND:
- case IMPLICIT_INNER:
- encl = make.Ident(params.first());
- }
+ if (tree.kind == ReferenceKind.ARRAY_CTOR) {
+ //create the array creation expression
+ JCNewArray newArr = make.NewArray(make.Type(types.elemtype(tree.getQualifierExpression().type)),
+ List.of(make.Ident(params.first())),
+ null);
+ newArr.type = tree.getQualifierExpression().type;
+ return newArr;
+ } else {
+ JCExpression encl = null;
+ switch (tree.kind) {
+ case UNBOUND:
+ case IMPLICIT_INNER:
+ encl = make.Ident(params.first());
+ }
- //create the instance creation expression
- JCNewClass newClass = make.NewClass(encl,
- List.<JCExpression>nil(),
- make.Type(tree.getQualifierExpression().type),
- convertArgs(tree.sym, args.toList(), tree.varargsElement),
- null);
- newClass.constructor = tree.sym;
- newClass.constructorType = tree.sym.erasure(types);
- newClass.type = tree.getQualifierExpression().type;
- setVarargsIfNeeded(newClass, tree.varargsElement);
- return newClass;
+ //create the instance creation expression
+ JCNewClass newClass = make.NewClass(encl,
+ List.<JCExpression>nil(),
+ make.Type(tree.getQualifierExpression().type),
+ convertArgs(tree.sym, args.toList(), tree.varargsElement),
+ null);
+ newClass.constructor = tree.sym;
+ newClass.constructorType = tree.sym.erasure(types);
+ newClass.type = tree.getQualifierExpression().type;
+ setVarargsIfNeeded(newClass, tree.varargsElement);
+ return newClass;
+ }
}
private VarSymbol addParameter(String name, Type p, boolean genArg) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Jan 16 12:14:29 2013 -0800
@@ -2386,10 +2386,23 @@
List<Type> typeargtypes,
boolean boxingAllowed) {
MethodResolutionPhase maxPhase = boxingAllowed ? VARARITY : BASIC;
+
+ ReferenceLookupHelper boundLookupHelper;
+ if (!name.equals(names.init)) {
+ //method reference
+ boundLookupHelper =
+ new MethodReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
+ } else if (site.hasTag(ARRAY)) {
+ //array constructor reference
+ boundLookupHelper =
+ new ArrayConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
+ } else {
+ //class constructor reference
+ boundLookupHelper =
+ new ConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
+ }
+
//step 1 - bound lookup
- ReferenceLookupHelper boundLookupHelper = name.equals(names.init) ?
- new ConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase) :
- new MethodReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
Env<AttrContext> boundEnv = env.dup(env.tree, env.info.dup());
Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(), site.tsym, boundLookupHelper);
@@ -2627,6 +2640,33 @@
}
/**
+ * Helper class for array constructor lookup; an array constructor lookup
+ * is simulated by looking up a method that returns the array type specified
+ * as qualifier, and that accepts a single int parameter (size of the array).
+ */
+ class ArrayConstructorReferenceLookupHelper extends ReferenceLookupHelper {
+
+ ArrayConstructorReferenceLookupHelper(JCMemberReference referenceTree, Type site, List<Type> argtypes,
+ List<Type> typeargtypes, MethodResolutionPhase maxPhase) {
+ super(referenceTree, names.init, site, argtypes, typeargtypes, maxPhase);
+ }
+
+ @Override
+ protected Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
+ Scope sc = new Scope(syms.arrayClass);
+ MethodSymbol arrayConstr = new MethodSymbol(PUBLIC, name, null, site.tsym);
+ arrayConstr.type = new MethodType(List.of(syms.intType), site, List.<Type>nil(), syms.methodClass);
+ sc.enter(arrayConstr);
+ return findMethodInScope(env, site, name, argtypes, typeargtypes, sc, methodNotFound, phase.isBoxingRequired(), phase.isVarargsRequired(), false, false);
+ }
+
+ @Override
+ ReferenceKind referenceKind(Symbol sym) {
+ return ReferenceKind.ARRAY_CTOR;
+ }
+ }
+
+ /**
* Helper class for constructor reference lookup. The lookup logic is based
* upon either Resolve.findMethod or Resolve.findDiamond - depending on
* whether the constructor reference needs diamond inference (this is the case
@@ -3381,7 +3421,10 @@
@Override
protected Symbol access(Name name, TypeSymbol location) {
- return ambiguousSyms.last();
+ Symbol firstAmbiguity = ambiguousSyms.last();
+ return firstAmbiguity.kind == TYP ?
+ types.createErrorType(name, location, firstAmbiguity.type).tsym :
+ firstAmbiguity;
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, 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
@@ -27,6 +27,8 @@
import java.lang.annotation.Annotation;
import java.lang.annotation.Inherited;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.Map;
import javax.lang.model.SourceVersion;
@@ -96,32 +98,43 @@
enter = Enter.instance(context);
}
-
/**
- * An internal-use utility that creates a reified annotation.
+ * An internal-use utility that creates a runtime view of an
+ * annotation. This is the implementation of
+ * Element.getAnnotation(Class).
*/
public static <A extends Annotation> A getAnnotation(Symbol annotated,
Class<A> annoType) {
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: "
+ annoType);
- String name = annoType.getName();
- for (Attribute.Compound anno : annotated.getAnnotationMirrors())
- if (name.equals(anno.type.tsym.flatName().toString()))
- return AnnotationProxyMaker.generateAnnotation(anno, annoType);
- return null;
+ Attribute.Compound c;
+ if (annotated.kind == Kinds.TYP && annotated instanceof ClassSymbol) {
+ c = getAttributeOnClass((ClassSymbol)annotated, annoType);
+ } else {
+ c = getAttribute(annotated, annoType);
+ }
+ return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
- /**
- * An internal-use utility that creates a reified annotation.
- * This overloaded version take annotation inheritance into account.
- */
- public static <A extends Annotation> A getAnnotation(ClassSymbol annotated,
- Class<A> annoType) {
+ // Helper to getAnnotation[s]
+ private static <A extends Annotation> Attribute.Compound getAttribute(Symbol annotated,
+ Class<A> annoType) {
+ String name = annoType.getName();
+
+ for (Attribute.Compound anno : annotated.getRawAttributes())
+ if (name.equals(anno.type.tsym.flatName().toString()))
+ return anno;
+
+ return null;
+ }
+ // Helper to getAnnotation[s]
+ private static <A extends Annotation> Attribute.Compound getAttributeOnClass(ClassSymbol annotated,
+ Class<A> annoType) {
boolean inherited = annoType.isAnnotationPresent(Inherited.class);
- A result = null;
+ Attribute.Compound result = null;
while (annotated.name != annotated.name.table.names.java_lang_Object) {
- result = getAnnotation((Symbol)annotated, annoType);
+ result = getAttribute(annotated, annoType);
if (result != null || !inherited)
break;
Type sup = annotated.getSuperclass();
@@ -132,6 +145,188 @@
return result;
}
+ /**
+ * An internal-use utility that creates a runtime view of
+ * annotations. This is the implementation of
+ * Element.getAnnotations(Class).
+ */
+ public static <A extends Annotation> A[] getAnnotations(Symbol annotated,
+ Class<A> annoType) {
+ if (!annoType.isAnnotation())
+ throw new IllegalArgumentException("Not an annotation type: "
+ + annoType);
+ // If annoType does not declare a container this is equivalent to wrapping
+ // getAnnotation(...) in an array.
+ Class <? extends Annotation> containerType = getContainer(annoType);
+ if (containerType == null) {
+ A res = getAnnotation(annotated, annoType);
+ int size;
+ if (res == null) {
+ size = 0;
+ } else {
+ size = 1;
+ }
+ @SuppressWarnings("unchecked") // annoType is the Class for A
+ A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
+ if (res != null)
+ arr[0] = res;
+ return arr;
+ }
+
+ // So we have a containing type
+ String name = annoType.getName();
+ String annoTypeName = annoType.getSimpleName();
+ String containerTypeName = containerType.getSimpleName();
+ int directIndex = -1, containerIndex = -1;
+ Attribute.Compound direct = null, container = null;
+ Attribute.Compound[] rawAttributes = annotated.getRawAttributes().toArray(new Attribute.Compound[0]);
+
+ // Find directly present annotations
+ for (int i = 0; i < rawAttributes.length; i++) {
+ if (annoTypeName.equals(rawAttributes[i].type.tsym.flatName().toString())) {
+ directIndex = i;
+ direct = rawAttributes[i];
+ } else if(containerTypeName != null &&
+ containerTypeName.equals(rawAttributes[i].type.tsym.flatName().toString())) {
+ containerIndex = i;
+ container = rawAttributes[i];
+ }
+ }
+ // Deal with inherited annotations
+ if (annotated.kind == Kinds.TYP &&
+ (annotated instanceof ClassSymbol)) {
+ ClassSymbol s = (ClassSymbol)annotated;
+ if (direct == null && container == null) {
+ direct = getAttributeOnClass(s, annoType);
+ container = getAttributeOnClass(s, containerType);
+
+ // both are inherited and found, put container last
+ if (direct != null && container != null) {
+ directIndex = 0;
+ containerIndex = 1;
+ } else if (direct != null) {
+ directIndex = 0;
+ } else {
+ containerIndex = 0;
+ }
+ } else if (direct == null) {
+ direct = getAttributeOnClass(s, annoType);
+ if (direct != null)
+ directIndex = containerIndex + 1;
+ } else if (container == null) {
+ container = getAttributeOnClass(s, containerType);
+ if (container != null)
+ containerIndex = directIndex + 1;
+ }
+ }
+
+ // Pack them in an array
+ Attribute[] contained0 = new Attribute[0];
+ if (container != null)
+ contained0 = unpackAttributes(container);
+ ListBuffer<Attribute.Compound> compounds = ListBuffer.lb();
+ for (Attribute a : contained0)
+ if (a instanceof Attribute.Compound)
+ compounds = compounds.append((Attribute.Compound)a);
+ Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[0]);
+
+ int size = (direct == null ? 0 : 1) + contained.length;
+ @SuppressWarnings("unchecked") // annoType is the Class for A
+ A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
+
+ // if direct && container, which is first?
+ int insert = -1;
+ int length = arr.length;
+ if (directIndex >= 0 && containerIndex >= 0) {
+ if (directIndex < containerIndex) {
+ arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+ insert = 1;
+ } else {
+ arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+ insert = 0;
+ length--;
+ }
+ } else if (directIndex >= 0) {
+ arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+ return arr;
+ } else {
+ // Only container
+ insert = 0;
+ }
+
+ for (int i = 0; i + insert < length; i++)
+ arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType);
+
+ return arr;
+ }
+
+ // Needed to unpack the runtime view of containing annotations
+ private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable();
+ private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod();
+
+ private static Class<? extends Annotation> initRepeatable() {
+ try {
+ @SuppressWarnings("unchecked") // java.lang.annotation.Repeatable extends Annotation by being an annotation type
+ Class<? extends Annotation> c = (Class)Class.forName("java.lang.annotation.Repeatable");
+ return c;
+ } catch (ClassNotFoundException e) {
+ return null;
+ } catch (SecurityException e) {
+ return null;
+ }
+ }
+ private static Method initValueElementMethod() {
+ if (REPEATABLE_CLASS == null)
+ return null;
+
+ Method m = null;
+ try {
+ m = REPEATABLE_CLASS.getMethod("value");
+ if (m != null)
+ m.setAccessible(true);
+ return m;
+ } catch (NoSuchMethodException e) {
+ return null;
+ }
+ }
+
+ // Helper to getAnnotations
+ private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
+ // Since we can not refer to java.lang.annotation.Repeatable until we are
+ // bootstrapping with java 8 we need to get the Repeatable annotation using
+ // reflective invocations instead of just using its type and element method.
+ if (REPEATABLE_CLASS != null &&
+ VALUE_ELEMENT_METHOD != null) {
+ // Get the Repeatable instance on the annotations declaration
+ Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS);
+ if (repeatable != null) {
+ try {
+ // Get the value element, it should be a class
+ // indicating the containing annotation type
+ @SuppressWarnings("unchecked")
+ Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable);
+ if (containerType == null)
+ return null;
+
+ return containerType;
+ } catch (ClassCastException e) {
+ return null;
+ } catch (IllegalAccessException e) {
+ return null;
+ } catch (InvocationTargetException e ) {
+ return null;
+ }
+ }
+ }
+ return null;
+ }
+ // Helper to getAnnotations
+ private static Attribute[] unpackAttributes(Attribute.Compound container) {
+ // We now have an instance of the container,
+ // unpack it returning an instance of the
+ // contained type or null
+ return ((Attribute.Array)container.member(container.type.tsym.name.table.names.value)).values;
+ }
public PackageSymbol getPackageElement(CharSequence name) {
String strName = name.toString();
@@ -238,8 +433,10 @@
tree.accept(vis);
if (vis.result == null)
return null;
+
+ List<Attribute.Compound> annos = sym.getRawAttributes();
return matchAnnoToTree(cast(Attribute.Compound.class, findme),
- sym.getAnnotationMirrors(),
+ annos,
vis.result);
}
@@ -442,7 +639,7 @@
*/
public List<Attribute.Compound> getAllAnnotationMirrors(Element e) {
Symbol sym = cast(Symbol.class, e);
- List<Attribute.Compound> annos = sym.getAnnotationMirrors();
+ List<Attribute.Compound> annos = sym.getRawAttributes();
while (sym.getKind() == ElementKind.CLASS) {
Type sup = ((ClassSymbol) sym).getSuperclass();
if (!sup.hasTag(CLASS) || sup.isErroneous() ||
@@ -451,7 +648,8 @@
}
sym = sup.tsym;
List<Attribute.Compound> oldAnnos = annos;
- for (Attribute.Compound anno : sym.getAnnotationMirrors()) {
+ List<Attribute.Compound> newAnnos = sym.getRawAttributes();
+ for (Attribute.Compound anno : newAnnos) {
if (isInherited(anno.type) &&
!containsAnnoOfType(oldAnnos, anno.type)) {
annos = annos.prepend(anno);
@@ -465,11 +663,7 @@
* Tests whether an annotation type is @Inherited.
*/
private boolean isInherited(Type annotype) {
- for (Attribute.Compound anno : annotype.tsym.getAnnotationMirrors()) {
- if (anno.type.tsym == syms.inheritedType.tsym)
- return true;
- }
- return false;
+ return annotype.tsym.attribute(syms.inheritedType.tsym) != null;
}
/**
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2013, 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
@@ -178,13 +178,22 @@
compiler.misc.incompatible.abstracts=\
multiple non-overriding abstract methods found in {0} {1}
-compiler.misc.not.a.functional.intf=\
- the target type must be a functional interface
+compiler.err.bad.functional.intf.anno=\
+ Unexpected @FunctionalInterface annotation
# 0: message segment
+compiler.err.bad.functional.intf.anno.1=\
+ Unexpected @FunctionalInterface annotation\n\
+ {0}
+
+# 0: symbol
+compiler.misc.not.a.functional.intf=\
+ {0} is not a functional interface
+
+# 0: symbol, 1: message segment
compiler.misc.not.a.functional.intf.1=\
- the target type must be a functional interface\n\
- {0}
+ {0} is not a functional interface\n\
+ {1}
# 0: symbol, 1: symbol kind, 2: symbol
compiler.misc.invalid.generic.lambda.target=\
@@ -319,64 +328,48 @@
compiler.err.duplicate.annotation.missing.container=\
duplicate annotation, the declaration of {0} does not have a valid {1} annotation
-# 0: type, 1: type
-compiler.err.invalid.container.no.containedby=\
- invalid contained repeatable annotation, {0} is not annotated with {1}
-
-# 0: type, 1: type
-compiler.err.invalid.container.wrong.containedby=\
- invalid contained repeatable annotation, {0} does not match {1}
-
-# 0: type, 1: type
-compiler.err.invalid.container.no.containerfor=\
- invalid container for repeating annotations, {0} is not annotated with {1}
-
-# 0: type, 1: type
-compiler.err.invalid.container.wrong.containerfor=\
- invalid container for repeating annotations, {0} does not match {1}
+# 0: type
+compiler.err.invalid.repeatable.annotation=\
+ duplicate annotation, {0} is annotated with an invalid Repeatable annotation
# 0: type
-compiler.err.invalid.containedby.annotation=\
- duplicate annotation, {0} is annotated with an invalid ContainedBy annotation
-
-# 0: type
-compiler.err.invalid.containedby.annotation.no.value=\
- duplicate annotation, {0} is not a valid ContainedBy, no value element method declared
+compiler.err.invalid.repeatable.annotation.no.value=\
+ duplicate annotation, {0} is not a valid Repeatable, no value element method declared
# 0: type, 1: number
-compiler.err.invalid.containedby.annotation.multiple.values=\
- duplicate annotation, {0} is not a valid ContainedBy, {1} value element methods declared
+compiler.err.invalid.repeatable.annotation.multiple.values=\
+ duplicate annotation, {0} is not a valid Repeatable, {1} value element methods declared
# 0: type
-compiler.err.invalid.containedby.annotation.invalid.value=\
- duplicate annotation, {0} is not a valid ContainedBy, invalid value element, need a method
+compiler.err.invalid.repeatable.annotation.invalid.value=\
+ duplicate annotation, {0} is not a valid Repeatable, invalid value element, need a method
# 0: type, 1: type, 2: type
-compiler.err.invalid.containedby.annotation.value.return=\
+compiler.err.invalid.repeatable.annotation.value.return=\
duplicate annotation, value element of containing annotation {0} should have type {2}, found {1}
# 0: type, 1: symbol
-compiler.err.invalid.containedby.annotation.elem.nondefault=\
+compiler.err.invalid.repeatable.annotation.elem.nondefault=\
containing annotation {0} does not have a default value for element {1}
# 0: symbol, 1: type, 2: symbol, 3: type
-compiler.err.invalid.containedby.annotation.retention=\
+compiler.err.invalid.repeatable.annotation.retention=\
containing annotation {0} has shorter retention ({1}) than the contained annotation {2} with retention {3}
# 0: symbol, 1: symbol
-compiler.err.invalid.containedby.annotation.not.documented=\
+compiler.err.invalid.repeatable.annotation.not.documented=\
containing annotation type, {0}, is not @Documented while repeated annotation type, {1}, is
# 0: symbol, 1: symbol
-compiler.err.invalid.containedby.annotation.not.inherited=\
+compiler.err.invalid.repeatable.annotation.not.inherited=\
containing annotation type, {0}, is not @Inherited while repeated annotation type, {1}, is
# 0: symbol, 1: symbol
-compiler.err.invalid.containedby.annotation.incompatible.target=\
+compiler.err.invalid.repeatable.annotation.incompatible.target=\
target of container annotation {0} is not a subset of target of repeated annotation {1}
# 0: symbol
-compiler.err.invalid.containedby.annotation.repeated.and.container.present=\
+compiler.err.invalid.repeatable.annotation.repeated.and.container.present=\
container {0} must not be present at the same time as the element it contains
# 0: name
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Wed Jan 16 12:14:29 2013 -0800
@@ -1838,7 +1838,9 @@
/** Inner # new */
IMPLICIT_INNER(ReferenceMode.NEW, false),
/** Toplevel # new */
- TOPLEVEL(ReferenceMode.NEW, false);
+ TOPLEVEL(ReferenceMode.NEW, false),
+ /** ArrayType # new */
+ ARRAY_CTOR(ReferenceMode.NEW, false);
final ReferenceMode mode;
final boolean unbound;
--- a/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Wed Jan 16 12:14:29 2013 -0800
@@ -288,7 +288,7 @@
public String simplify(Symbol s) {
String name = s.getQualifiedName().toString();
- if (!s.type.isCompound()) {
+ if (!s.type.isCompound() && !s.type.isPrimitive()) {
List<Symbol> conflicts = nameClashes.get(s.getSimpleName());
if (conflicts == null ||
(conflicts.size() == 1 &&
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -31,8 +31,10 @@
import javax.tools.JavaFileManager;
import com.sun.javadoc.*;
+import com.sun.source.util.JavacTask;
import com.sun.source.util.TreePath;
-import com.sun.tools.javac.api.JavacTrees;
+import com.sun.tools.doclint.DocLint;
+import com.sun.tools.javac.api.BasicJavacTask;
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type.ClassType;
@@ -105,6 +107,7 @@
Types types;
JavaFileManager fileManager;
Context context;
+ DocLint doclint;
WeakHashMap<JCTree, TreePath> treePaths = new WeakHashMap<JCTree, TreePath>();
@@ -400,6 +403,9 @@
public void warning(DocImpl doc, String key, String a1) {
if (silent)
return;
+ // suppress messages that have (probably) been covered by doclint
+ if (doclint != null && doc != null && key.startsWith("tag"))
+ return;
messager.warning(doc==null ? null : doc.position(), key, a1);
}
@@ -732,9 +738,15 @@
return p;
}
- TreePath getTreePath(JCCompilationUnit toplevel, JCTree tree) {
- // don't bother to cache paths for classes and members
- return new TreePath(getTreePath(toplevel), tree);
+ TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl tree) {
+ TreePath p = treePaths.get(tree);
+ if (p == null)
+ treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree));
+ return p;
+ }
+
+ TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl cdecl, JCTree tree) {
+ return new TreePath(getTreePath(toplevel, cdecl), tree);
}
/**
@@ -781,4 +793,25 @@
result |= Modifier.VOLATILE;
return result;
}
+
+ void initDoclint(Collection<String> opts) {
+ ArrayList<String> doclintOpts = new ArrayList<String>();
+
+ for (String opt: opts) {
+ doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
+ }
+
+ if (doclintOpts.size() == 1
+ && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
+ return;
+ }
+
+ JavacTask t = BasicJavacTask.instance(context);
+ doclint = new DocLint();
+ doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
+ }
+
+ boolean showTagMessages() {
+ return (doclint == null);
+ }
}
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocImpl.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocImpl.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -126,7 +126,13 @@
*/
Comment comment() {
if (comment == null) {
- comment = new Comment(this, documentation());
+ String d = documentation();
+ if (env.doclint != null
+ && treePath != null
+ && d.equals(getCommentText(treePath))) {
+ env.doclint.scan(treePath);
+ }
+ comment = new Comment(this, d);
}
return comment;
}
--- a/langtools/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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 @@
super.visitMethodDef(tree);
MethodSymbol meth = tree.sym;
if (meth == null || meth.kind != Kinds.MTH) return;
- TreePath treePath = docenv.getTreePath(env.toplevel, tree);
+ TreePath treePath = docenv.getTreePath(env.toplevel, env.enclClass, tree);
if (meth.isConstructor())
docenv.makeConstructorDoc(meth, treePath);
else if (isAnnotationTypeElement(meth))
@@ -90,7 +90,7 @@
if (tree.sym != null &&
tree.sym.kind == Kinds.VAR &&
!isParameter(tree.sym)) {
- docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, tree));
+ docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
}
}
--- a/langtools/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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,13 +26,14 @@
package com.sun.tools.javadoc;
import java.io.IOException;
+import java.util.Collection;
import java.util.Locale;
+
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import com.sun.javadoc.*;
-
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
@@ -375,4 +376,12 @@
public JavaFileManager getFileManager() {
return env.fileManager;
}
+
+ public void initDocLint(Collection<String> opts) {
+ env.initDoclint(opts);
+ }
+
+ public boolean showTagMessages() {
+ return env.showTagMessages();
+ }
}
--- a/langtools/src/share/classes/javax/lang/model/element/Element.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/element/Element.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, 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
@@ -149,6 +149,56 @@
<A extends Annotation> A getAnnotation(Class<A> annotationType);
/**
+ * Returns an array of all of this element's annotation for the
+ * specified type if such annotations are present, else an empty
+ * array. The annotation may be either inherited or directly
+ * present on this element. This method will look through a container
+ * annotation (if present) if the supplied annotation type is
+ * repeatable.
+ *
+ * <p> The annotations returned by this method could contain an element
+ * whose value is of type {@code Class}.
+ * This value cannot be returned directly: information necessary to
+ * locate and load a class (such as the class loader to use) is
+ * not available, and the class might not be loadable at all.
+ * Attempting to read a {@code Class} object by invoking the relevant
+ * method on the returned annotation
+ * will result in a {@link MirroredTypeException},
+ * from which the corresponding {@link TypeMirror} may be extracted.
+ * Similarly, attempting to read a {@code Class[]}-valued element
+ * will result in a {@link MirroredTypesException}.
+ *
+ * <blockquote>
+ * <i>Note:</i> This method is unlike others in this and related
+ * interfaces. It operates on runtime reflective information —
+ * representations of annotation types currently loaded into the
+ * VM — rather than on the representations defined by and used
+ * throughout these interfaces. Consequently, calling methods on
+ * the returned annotation object can throw many of the exceptions
+ * that can be thrown when calling methods on an annotation object
+ * returned by core reflection. This method is intended for
+ * callers that are written to operate on a known, fixed set of
+ * annotation types.
+ * </blockquote>
+ *
+ * @param <A> the annotation type
+ * @param annotationType the {@code Class} object corresponding to
+ * the annotation type
+ * @return this element's annotations for the specified annotation
+ * type if present on this element, else an empty array
+ *
+ * @see #getAnnotationMirrors()
+ * @see #getAnnotation(java.lang.Class)
+ * @see java.lang.reflect.AnnotatedElement#getAnnotations
+ * @see EnumConstantNotPresentException
+ * @see AnnotationTypeMismatchException
+ * @see IncompleteAnnotationException
+ * @see MirroredTypeException
+ * @see MirroredTypesException
+ */
+ <A extends Annotation> A[] getAnnotations(Class<A> annotationType);
+
+ /**
* Returns the modifiers of this element, excluding annotations.
* Implicit modifiers, such as the {@code public} and {@code static}
* modifiers of interface members, are included.
--- a/langtools/test/com/sun/javadoc/5093723/T5093723.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/5093723/T5093723.java Wed Jan 16 12:14:29 2013 -0800
@@ -36,7 +36,7 @@
private static final String BUG_ID = "5093723";
private static final String[] ARGS = new String[] {
- "-d", BUG_ID + ".out", "-source", "5",
+ "-d", BUG_ID + ".out", "-source", "5", "-Xdoclint:none",
SRC_DIR + "/DocumentedClass.java",
SRC_DIR + "/UndocumentedClass.java"
};
--- a/langtools/test/com/sun/javadoc/DocRootSlash/DocRootSlash.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/DocRootSlash/DocRootSlash.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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,6 +60,7 @@
String srcdir = System.getProperty("test.src", ".");
runJavadoc(new String[] {"-d", TMPDIR_STRING1,
+ "-Xdoclint:none",
"-overview", (srcdir + FS + "overview.html"),
"-header", "<A HREF=\"{@docroot}/package-list\">{@docroot}</A> <A HREF=\"{@docRoot}/help-doc\">{@docRoot}</A>",
"-sourcepath", srcdir,
--- a/langtools/test/com/sun/javadoc/testBadSourceFile/TestBadSourceFile.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testBadSourceFile/TestBadSourceFile.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -40,7 +40,7 @@
//Javadoc arguments.
private static final String[] ARGS = new String[] {
- "-d", BUG_ID, SRC_DIR + FS + "C2.java"
+ "-Xdoclint:none", "-d", BUG_ID, SRC_DIR + FS + "C2.java"
};
//Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, 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
@@ -222,19 +222,19 @@
private static final String[] ARGS1 =
new String[] {
- "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
+ "-Xdoclint:none", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS2 =
new String[] {
- "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
+ "-Xdoclint:none", "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS3 =
new String[] {
- "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
+ "-Xdoclint:none", "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS4 =
new String[] {
- "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
+ "-Xdoclint:none", "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
/**
* The entry point of the test.
--- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -40,7 +40,7 @@
//Javadoc arguments.
private static final String[] ARGS = new String[] {
- "-d", BUG_ID, "-use", "-source", "1.5", "-sourcepath", SRC_DIR, "pkg", "pkg1", "pkg2"
+ "-Xdoclint:none", "-d", BUG_ID, "-use", "-source", "1.5", "-sourcepath", SRC_DIR, "pkg", "pkg1", "pkg2"
};
//Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testRepeatedAnnotations/pkg/ContaineeSynthDoc.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testRepeatedAnnotations/pkg/ContaineeSynthDoc.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,6 @@
* @author Bhavesh Patel
*/
@Documented
-@ContainedBy(ContainerSynthDoc.class)
+@Repeatable(ContainerSynthDoc.class)
public @interface ContaineeSynthDoc {
}
--- a/langtools/test/com/sun/javadoc/testRepeatedAnnotations/pkg/ContainerSynthDoc.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testRepeatedAnnotations/pkg/ContainerSynthDoc.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@
* @author Bhavesh Patel
*/
@Documented
-@ContainerFor(ContaineeSynthDoc.class)
public @interface ContainerSynthDoc {
ContaineeSynthDoc[] value();
--- a/langtools/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/ContaineeSynthDoc.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/ContaineeSynthDoc.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,6 @@
* @author Bhavesh Patel
*/
@Documented
-@ContainedBy(ContainerSynthNotDoc.class)
+@Repeatable(ContainerSynthNotDoc.class)
public @interface ContaineeSynthDoc {
}
--- a/langtools/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/ContainerSynthNotDoc.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/ContainerSynthNotDoc.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -31,7 +31,6 @@
*
* @author Bhavesh Patel
*/
-@ContainerFor(ContaineeSynthDoc.class)
public @interface ContainerSynthNotDoc {
ContaineeSynthDoc[] value();
--- a/langtools/test/com/sun/javadoc/testReturnTag/TestReturnTag.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testReturnTag/TestReturnTag.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -39,7 +39,7 @@
//Javadoc arguments.
private static final String[] ARGS = new String[] {
- "-d", BUG_ID, "-sourcepath", SRC_DIR, SRC_DIR + FS + "TestReturnTag.java"
+ "-Xdoclint:none", "-d", BUG_ID, "-sourcepath", SRC_DIR, SRC_DIR + FS + "TestReturnTag.java"
};
//Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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
@@ -36,7 +36,7 @@
private static final String BUG_ID = "4496223-4496270-4618686-4720974-4812240-6253614-6253604";
private static final String[] ARGS = new String[] {
- "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "firstSentence", "firstSentence2"
+ "-Xdoclint:none", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "firstSentence", "firstSentence2"
};
/**
--- a/langtools/test/com/sun/javadoc/testTagMisuse/TestTagMisuse.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testTagMisuse/TestTagMisuse.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, 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
@@ -42,7 +42,7 @@
};
private static final String[][] NEGATED_TEST = NO_TEST;
private static final String[] ARGS = new String[] {
- "-d", BUG_ID, SRC_DIR + FS + "TestTagMisuse.java"
+ "-Xdoclint:none", "-d", BUG_ID, SRC_DIR + FS + "TestTagMisuse.java"
};
/**
--- a/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -41,6 +41,7 @@
//Javadoc arguments.
private static final String[] ARGS =
new String[] {
+ "-Xdoclint:none",
"-d", BUG_ID, "-sourcepath", SRC_DIR, "-tag",
"todo", "pkg1", "pkg2"
};
--- a/langtools/test/com/sun/javadoc/testWarnBadParamNames/TestWarnBadParamNames.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testWarnBadParamNames/TestWarnBadParamNames.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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,7 +43,7 @@
};
private static final String[][] NEGATED_TEST = NO_TEST;
private static final String[] ARGS = new String[] {
- "-d", BUG_ID, SRC_DIR + FS + "C.java"
+ "-Xdoclint:none", "-d", BUG_ID, SRC_DIR + FS + "C.java"
};
/**
--- a/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, 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,11 +43,11 @@
//Javadoc arguments.
private static final String[] ARGS = new String[] {
- "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
+ "-Xdoclint:none", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
};
private static final String[] ARGS2 = new String[] {
- "-d", BUG_ID, "-private", "-sourcepath", SRC_DIR, "pkg"
+ "-Xdoclint:none", "-d", BUG_ID, "-private", "-sourcepath", SRC_DIR, "pkg"
};
//Input for string search tests.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/AnchorTest.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,93 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8004832
+ * @summary Add new doclint package
+ * @build DocLintTester
+ * @run main DocLintTester -ref AnchorTest.out AnchorTest.java
+ */
+
+/** */
+public class AnchorTest {
+ // tests for <a name=value>
+
+ /**
+ * <a name=foo></a>
+ */
+ public void a_name_foo() { }
+
+ /**
+ * <a name=foo></a>
+ */
+ public void a_name_already_defined() { }
+
+ /**
+ * <a name=></a>
+ */
+ public void a_name_empty() { }
+
+ /**
+ * <a name=123 ></a>
+ */
+ public void a_name_invalid() { }
+
+ /**
+ * <a name ></a>
+ */
+ public void a_name_missing() { }
+
+ // tests for <a id=value>
+
+ /**
+ * <a id=a_id_foo></a>
+ */
+ public void a_id_foo() { }
+
+ /**
+ * <a id=foo></a>
+ */
+ public void a_id_already_defined() { }
+
+ /**
+ * <a id=></a>
+ */
+ public void a_id_empty() { }
+
+ /**
+ * <a id=123 ></a>
+ */
+ public void a_id_invalid() { }
+
+ /**
+ * <a id ></a>
+ */
+ public void a_id_missing() { }
+
+ // tests for id=value on non-<a> tags
+
+ /**
+ * <p id=p_id_foo>text</p>
+ */
+ public void p_id_foo() { }
+
+ /**
+ * <p id=foo>text</p>
+ */
+ public void p_id_already_defined() { }
+
+ /**
+ * <p id=>text</p>
+ */
+ public void p_id_empty() { }
+
+ /**
+ * <p id=123 >text</p>
+ */
+ public void p_id_invalid() { }
+
+ /**
+ * <p id >text</p>
+ */
+ public void p_id_missing() { }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/AnchorTest.out Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,37 @@
+AnchorTest.java:19: error: anchor already defined: foo
+ * <a name=foo></a>
+ ^
+AnchorTest.java:24: error: invalid name for anchor: ""
+ * <a name=></a>
+ ^
+AnchorTest.java:29: error: invalid name for anchor: "123"
+ * <a name=123 ></a>
+ ^
+AnchorTest.java:34: error: no value given for anchor
+ * <a name ></a>
+ ^
+AnchorTest.java:46: error: anchor already defined: foo
+ * <a id=foo></a>
+ ^
+AnchorTest.java:51: error: invalid name for anchor: ""
+ * <a id=></a>
+ ^
+AnchorTest.java:56: error: invalid name for anchor: "123"
+ * <a id=123 ></a>
+ ^
+AnchorTest.java:61: error: no value given for anchor
+ * <a id ></a>
+ ^
+AnchorTest.java:73: error: anchor already defined: foo
+ * <p id=foo>text</p>
+ ^
+AnchorTest.java:78: error: invalid name for anchor: ""
+ * <p id=>text</p>
+ ^
+AnchorTest.java:83: error: invalid name for anchor: "123"
+ * <p id=123 >text</p>
+ ^
+AnchorTest.java:88: error: no value given for anchor
+ * <p id >text</p>
+ ^
+12 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/EndTagsTest.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,39 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006236
+ * @summary doclint: structural issue hidden
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs:-html EndTagsTest.java
+ * @run main DocLintTester -ref EndTagsTest.out EndTagsTest.java
+ */
+
+/** */
+public class EndTagsTest {
+ /** <p> <a name="a1"> text <img alt="image" src="image.png"> </a> </p> */
+ public void valid_all() { }
+
+ /** <p> <a name="a2"> text <img alt="image" src="image.png"> </a> */
+ public void valid_omit_optional_close() { }
+
+ /** </a> */
+ public void invalid_missing_start() { }
+
+ /** <p> </a> */
+ public void invalid_missing_start_2() { }
+
+ /** <p> text </p> </a> */
+ public void invalid_missing_start_3() { }
+
+ /** <img alt="image" src="image.png"> </img> */
+ public void invalid_end() { }
+
+ /** <invalid> </invalid> */
+ public void unknown_start_end() { }
+
+ /** <invalid> */
+ public void unknown_start() { }
+
+ /** </invalid> */
+ public void unknown_end() { }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/EndTagsTest.out Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,25 @@
+EndTagsTest.java:18: error: unexpected end tag: </a>
+ /** </a> */
+ ^
+EndTagsTest.java:21: error: unexpected end tag: </a>
+ /** <p> </a> */
+ ^
+EndTagsTest.java:24: error: unexpected end tag: </a>
+ /** <p> text </p> </a> */
+ ^
+EndTagsTest.java:27: error: invalid end tag: </img>
+ /** <img alt="image" src="image.png"> </img> */
+ ^
+EndTagsTest.java:30: error: unknown tag: invalid
+ /** <invalid> </invalid> */
+ ^
+EndTagsTest.java:30: error: unknown tag: invalid
+ /** <invalid> </invalid> */
+ ^
+EndTagsTest.java:33: error: unknown tag: invalid
+ /** <invalid> */
+ ^
+EndTagsTest.java:36: error: unknown tag: invalid
+ /** </invalid> */
+ ^
+8 errors
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.java Wed Jan 16 12:14:29 2013 -0800
@@ -6,11 +6,9 @@
* @compile/fail/ref=BaseAnnoAsContainerAnno.out -XDrawDiagnostics BaseAnnoAsContainerAnno.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy(Foo.class)
-@ContainerFor(Foo.class)
+@Repeatable(Foo.class)
@interface Foo {
Foo[] value() default {};
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,2 +1,2 @@
-BaseAnnoAsContainerAnno.java:15:11: compiler.err.cyclic.annotation.element
+BaseAnnoAsContainerAnno.java:13:11: compiler.err.cyclic.annotation.element
1 error
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/BasicRepeatingAnnotations.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/BasicRepeatingAnnotations.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,10 +34,9 @@
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
@interface Foo {}
-@ContainerFor(Foo.class)
@Retention(RetentionPolicy.RUNTIME)
@interface Foos {
Foo[] value();
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/CheckTargets.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/CheckTargets.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,32 +32,29 @@
import java.lang.annotation.*;
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
@Target(ElementType.TYPE)
@interface Foo {}
-@ContainerFor(Foo.class)
@Target(ElementType.ANNOTATION_TYPE)
@interface Foos {
Foo[] value();
}
-@ContainedBy(Bars.class)
+@Repeatable(Bars.class)
@Target(ElementType.TYPE)
@interface Bar {}
-@ContainerFor(Bar.class)
@Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE })
@interface Bars {
Bar[] value();
}
-@ContainedBy(Bazs.class)
+@Repeatable(Bazs.class)
@Target({ ElementType.TYPE, ElementType.ANNOTATION_TYPE })
@interface Baz {}
-@ContainerFor(Baz.class)
@Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE })
@interface Bazs {
Baz[] value();
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/ClassReaderDefault.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/ClassReaderDefault.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -30,17 +30,15 @@
* @compile ClassReaderDefault.java
* @compile SeparateCompile.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
public class ClassReaderDefault {
}
-@ContainerFor(Foo.class)
@interface FooContainer {
Foo[] value();
int f() default 0;
}
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
@interface Foo {}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/ContainerHasRepeatedContained.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/ContainerHasRepeatedContained.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -30,15 +30,13 @@
* @run compile ContainerHasRepeatedContained.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy(BarContainer.class)
+@Repeatable(BarContainer.class)
@interface Bar {}
@Bar
@Bar
-@ContainerFor(Bar.class)
@interface BarContainer {
Bar[] value();
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.java Wed Jan 16 12:14:29 2013 -0800
@@ -6,17 +6,14 @@
* @compile/fail/ref=CyclicAnnotation.out -XDrawDiagnostics CyclicAnnotation.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy(Foo.class)
-@ContainerFor(Baz.class)
+@Repeatable(Foo.class)
@interface Baz {
Foo[] value() default {};
}
-@ContainedBy(Baz.class)
-@ContainerFor(Foo.class)
+@Repeatable(Baz.class)
@interface Foo{
Baz[] value() default {};
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,6 +1,2 @@
-CyclicAnnotation.java:12:1: compiler.err.invalid.container.wrong.containerfor: Foo, Baz
-CyclicAnnotation.java:13:1: compiler.err.invalid.container.wrong.containedby: Foo, Baz
-CyclicAnnotation.java:15:11: compiler.err.cyclic.annotation.element
-CyclicAnnotation.java:18:1: compiler.err.invalid.container.wrong.containerfor: Baz, Foo
-CyclicAnnotation.java:19:1: compiler.err.invalid.container.wrong.containedby: Baz, Foo
-5 errors
+CyclicAnnotation.java:13:11: compiler.err.cyclic.annotation.element
+1 error
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/DefaultCasePresent.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/DefaultCasePresent.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -29,13 +29,11 @@
* @compile DefaultCasePresent.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
@interface Foo {}
-@ContainerFor(Foo.class)
@interface FooContainer {
Foo[] value();
String other() default "other-method";
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/DelayRepeatedContainer.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/DelayRepeatedContainer.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -39,12 +39,11 @@
@Bar("katt")
@Bar("lol")
-@ContainedBy(BarContainer.class)
+@Repeatable(BarContainer.class)
@interface Bar {
String value();
}
-@ContainerFor(Bar.class)
@interface BarContainer {
Bar[] value();
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/DocumentedContainerAnno.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/DocumentedContainerAnno.java Wed Jan 16 12:14:29 2013 -0800
@@ -6,15 +6,13 @@
* @compile/fail/ref=DocumentedContainerAnno.out -XDrawDiagnostics DocumentedContainerAnno.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Documented;
@Documented
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
@interface Foo {}
-@ContainerFor(Foo.class)
@interface FooContainer{
Foo[] value();
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/DocumentedContainerAnno.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/DocumentedContainerAnno.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,2 +1,2 @@
-DocumentedContainerAnno.java:14:1: compiler.err.invalid.containedby.annotation.not.documented: FooContainer, Foo
+DocumentedContainerAnno.java:13:1: compiler.err.invalid.repeatable.annotation.not.documented: FooContainer, Foo
1 error
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/InheritedContainerAnno.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InheritedContainerAnno.java Wed Jan 16 12:14:29 2013 -0800
@@ -6,15 +6,13 @@
* @compile/fail/ref=InheritedContainerAnno.out -XDrawDiagnostics InheritedContainerAnno.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Inherited;
@Inherited
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
@interface Foo {}
-@ContainerFor(Foo.class)
@interface FooContainer{
Foo[] value();
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/InheritedContainerAnno.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InheritedContainerAnno.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,2 +1,2 @@
-InheritedContainerAnno.java:14:1: compiler.err.invalid.containedby.annotation.not.inherited: FooContainer, Foo
+InheritedContainerAnno.java:13:1: compiler.err.invalid.repeatable.annotation.not.inherited: FooContainer, Foo
1 error
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidTarget.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidTarget.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,10 @@
import java.lang.annotation.*;
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
@Target(ElementType.ANNOTATION_TYPE)
@interface Foo {}
-@ContainerFor(Foo.class)
@Target(ElementType.TYPE)
@interface Foos {
Foo[] value();
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingContainedBy.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2012, 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
- * @summary Smoke test for repeating annotations
- * @compile/fail MissingContainedBy.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-
-@ContainerFor(MissingContainedBy.class)
-@interface Foos {
- MissingContainedBy[] value();
-}
-
-public @interface MissingContainedBy {}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingContainer.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingContainer.java Wed Jan 16 12:14:29 2013 -0800
@@ -6,13 +6,11 @@
* @compile/fail/ref=MissingContainer.out -XDrawDiagnostics MissingContainer.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy()
+@Repeatable()
@interface Foo {}
-@ContainerFor(Foo.class)
@interface FooContainer {
Foo[] value();
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingContainer.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingContainer.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,4 @@
-MissingContainer.java:20:1: compiler.err.invalid.containedby.annotation: Foo
-MissingContainer.java:20:6: compiler.err.invalid.containedby.annotation: Foo
-MissingContainer.java:12:1: compiler.err.annotation.missing.default.value: java.lang.annotation.ContainedBy, value
-MissingContainer.java:15:1: compiler.err.invalid.container.wrong.containedby: Foo, FooContainer
-4 errors
+MissingContainer.java:18:1: compiler.err.invalid.repeatable.annotation: Foo
+MissingContainer.java:18:6: compiler.err.invalid.repeatable.annotation: Foo
+MissingContainer.java:11:1: compiler.err.annotation.missing.default.value: java.lang.annotation.Repeatable, value
+3 errors
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingContainerFor.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2012, 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
- * @summary Smoke test for repeating annotations
- * @compile/fail MissingContainerFor.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-@interface Foos {
- MissingContainerFor[] value();
-}
-
-@ContainedBy(Foos.class)
-public @interface MissingContainerFor {}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase1.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase1.java Wed Jan 16 12:14:29 2013 -0800
@@ -6,13 +6,11 @@
* @compile/fail/ref=MissingDefaultCase1.out -XDrawDiagnostics MissingDefaultCase1.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
@interface Foo {}
-@ContainerFor(Foo.class)
@interface FooContainer {
Foo[] value();
String other(); // missing default clause
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase1.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase1.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,3 +1,3 @@
-MissingDefaultCase1.java:21:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
-MissingDefaultCase1.java:12:1: compiler.err.invalid.containedby.annotation.elem.nondefault: FooContainer, other()
+MissingDefaultCase1.java:19:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
+MissingDefaultCase1.java:11:1: compiler.err.invalid.repeatable.annotation.elem.nondefault: FooContainer, other()
2 errors
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase2.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase2.java Wed Jan 16 12:14:29 2013 -0800
@@ -6,13 +6,11 @@
* @compile/fail/ref=MissingDefaultCase2.out -XDrawDiagnostics MissingDefaultCase2.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
@interface Foo {}
-@ContainerFor(Foo.class)
@interface FooContainer {
Foo[] value();
Foo other(); // missing default clause and return type is an annotation
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase2.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase2.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,3 +1,3 @@
-MissingDefaultCase2.java:21:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
-MissingDefaultCase2.java:12:1: compiler.err.invalid.containedby.annotation.elem.nondefault: FooContainer, other()
+MissingDefaultCase2.java:19:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
+MissingDefaultCase2.java:11:1: compiler.err.invalid.repeatable.annotation.elem.nondefault: FooContainer, other()
2 errors
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingValueMethod.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingValueMethod.java Wed Jan 16 12:14:29 2013 -0800
@@ -6,13 +6,11 @@
* @compile/fail/ref=MissingValueMethod.out -XDrawDiagnostics MissingValueMethod.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
@interface Foo {}
-@ContainerFor(Foo.class)
@interface FooContainer{
Foo[] values(); // wrong method name
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingValueMethod.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/MissingValueMethod.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,4 +1,4 @@
-MissingValueMethod.java:20:1: compiler.err.invalid.containedby.annotation.no.value: FooContainer
-MissingValueMethod.java:20:6: compiler.err.invalid.containedby.annotation.no.value: FooContainer
-MissingValueMethod.java:12:1: compiler.err.invalid.containedby.annotation.elem.nondefault: FooContainer, values()
+MissingValueMethod.java:18:1: compiler.err.invalid.repeatable.annotation.no.value: FooContainer
+MissingValueMethod.java:18:6: compiler.err.invalid.repeatable.annotation.no.value: FooContainer
+MissingValueMethod.java:11:1: compiler.err.invalid.repeatable.annotation.no.value: FooContainer
3 errors
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MultiLevelRepeatableAnno.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/MultiLevelRepeatableAnno.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -29,19 +29,16 @@
* @compile MultiLevelRepeatableAnno.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
@interface Foo {}
-@ContainedBy(FooContainerContainer.class)
-@ContainerFor(Foo.class)
+@Repeatable(FooContainerContainer.class)
@interface FooContainer {
Foo[] value();
}
-@ContainerFor(FooContainer.class)
@interface FooContainerContainer {
FooContainer[] value();
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/MultipleAnnoMixedOrder.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/MultipleAnnoMixedOrder.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -29,25 +29,22 @@
* @compile MultipleAnnoMixedOrder.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
@interface Foo {
int getNumbers();
}
-@ContainerFor(Foo.class)
@interface FooContainer {
Foo[] value();
}
-@ContainedBy(BazContainer.class)
+@Repeatable(BazContainer.class)
@interface Baz {
String getStr();
}
-@ContainerFor(Baz.class)
@interface BazContainer {
Baz[] value();
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/NestedContainers.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/NestedContainers.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,17 +34,15 @@
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
@interface Foo {}
@Retention(RetentionPolicy.RUNTIME)
-@ContainedBy(FoosFoos.class)
-@ContainerFor(Foo.class)
+@Repeatable(FoosFoos.class)
@interface Foos {
Foo[] value();
}
-@ContainerFor(Foos.class)
@Retention(RetentionPolicy.RUNTIME)
@interface FoosFoos {
Foos[] value();
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/NoRepeatableAnno.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/NoRepeatableAnno.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,3 +1,3 @@
-NoRepeatableAnno.java:11:1: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.ContainedBy
-NoRepeatableAnno.java:11:6: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.ContainedBy
+NoRepeatableAnno.java:11:1: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.Repeatable
+NoRepeatableAnno.java:11:6: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.Repeatable
2 errors
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/RepMemberAnno.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/RepMemberAnno.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -30,20 +30,18 @@
* @run compile RepMemberAnno.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
public class RepMemberAnno {
@Bar("Apa") @Bar("Banan")
public void meh() {}
}
-@ContainedBy(BarContainer.class)
+@Repeatable(BarContainer.class)
@interface Bar {
String value();
}
-@ContainerFor(Bar.class)
@interface BarContainer {
Bar[] value();
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/RepSelfMemberAnno.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/RepSelfMemberAnno.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,21 +34,19 @@
@Retention(RetentionPolicy.RUNTIME)
-@ContainedBy(BarContainer.class)
+@Repeatable(BarContainer.class)
public @interface RepSelfMemberAnno {
@RepSelfMemberAnno @RepSelfMemberAnno
String meh() default "banan";
}
-@ContainedBy(BarContainerContainer.class)
+@Repeatable(BarContainerContainer.class)
@Retention(RetentionPolicy.RUNTIME)
-@ContainerFor(RepSelfMemberAnno.class)
@interface BarContainer {
RepSelfMemberAnno[] value();
}
-@ContainerFor(BarContainer.class)
@Retention(RetentionPolicy.RUNTIME)
@interface BarContainerContainer {
BarContainer[] value();
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/RepeatingAndContainerPresent.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/RepeatingAndContainerPresent.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -30,7 +30,7 @@
import java.lang.annotation.*;
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
@interface Foo {}
@interface Foos {
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/RepeatingTargetNotAllowed.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/RepeatingTargetNotAllowed.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -31,10 +31,9 @@
import java.lang.annotation.*;
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
@interface Foo {}
-@ContainerFor(Foo.class)
@Target(ElementType.ANNOTATION_TYPE)
@interface Foos {
Foo[] value();
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/RepeatingTargetNotAllowed.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/RepeatingTargetNotAllowed.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,2 +1,2 @@
-RepeatingTargetNotAllowed.java:44:5: compiler.err.invalid.containedby.annotation.incompatible.target: Foos, Foo
+RepeatingTargetNotAllowed.java:43:5: compiler.err.invalid.repeatable.annotation.incompatible.target: Foos, Foo
1 error
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/SelfRepeatingAnnotations.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/SelfRepeatingAnnotations.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -33,7 +33,6 @@
import java.lang.annotation.*;
-@ContainerFor(SelfRepeatingAnno.class)
@Retention(RetentionPolicy.RUNTIME)
@interface Foos {
SelfRepeatingAnno[] value();
@@ -42,7 +41,7 @@
@SelfRepeatingAnno
@Retention(RetentionPolicy.RUNTIME)
@SelfRepeatingAnno
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
@interface SelfRepeatingAnno {}
public class SelfRepeatingAnnotations {
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/SingleRepeatingAndContainer.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/SingleRepeatingAndContainer.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -30,10 +30,9 @@
import java.lang.annotation.*;
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
@interface Foo {}
-@ContainerFor(Foo.class)
@interface Foos {
Foo[] value();
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/UseWrongContainedBy.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2012, 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
- * @summary Smoke test for repeating annotations
- * @compile/fail UseWrongContainedBy.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-@ContainerFor(UseWrongContainedBy.class)
-@interface Foos {
- UseWrongContainedBy[] value();
-}
-
-@ContainedBy(Target.class)
-public @interface UseWrongContainedBy {}
-
-@UseWrongContainedBy @UseWrongContainedBy
-@interface Foo {}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/UseWrongContainerFor.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2012, 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
- * @summary Smoke test for repeating annotations
- * @compile/fail UseWrongContainerFor.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-@ContainerFor(Retention.class)
-@interface Foos {
- UseWrongContainerFor[] value();
-}
-
-@ContainedBy(Foos.class)
-public @interface UseWrongContainerFor {}
-
-@UseWrongContainerFor @UseWrongContainerFor
-@interface Foo {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/UseWrongRepeatable.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012, 2013, 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
+ * @summary Smoke test for repeating annotations
+ * @compile/fail UseWrongRepeatable.java
+ * @bug 7151010
+ */
+
+import java.lang.annotation.*;
+
+@interface Foos {
+ UseWrongRepeatable[] value();
+}
+
+@Repeatable(Target.class)
+public @interface UseWrongRepeatable {}
+
+@UseWrongRepeatable @UseWrongRepeatable
+@interface Foo {}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/WrongContainedBy.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2012, 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
- * @summary Smoke test for repeating annotations
- * @compile/fail WrongContainedBy.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-@ContainerFor(WrongContainedBy.class)
-@interface Foos {
- WrongContainedBy[] value();
-}
-
-@ContainedBy(Target.class)
-public @interface WrongContainedBy {}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/WrongContainerFor.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2012, 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
- * @summary Smoke test for repeating annotations
- * @compile/fail WrongContainerFor.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-@ContainerFor(Retention.class)
-@interface Foos {
- WrongContainerFor[] value();
-}
-
-@ContainedBy(Foos.class)
-public @interface WrongContainerFor {}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/WrongReturnTypeForValue.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/WrongReturnTypeForValue.java Wed Jan 16 12:14:29 2013 -0800
@@ -6,15 +6,13 @@
* @compile/fail/ref=WrongReturnTypeForValue.out -XDrawDiagnostics WrongReturnTypeForValue.java
*/
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
@interface Foo {
int getNumbers();
}
-@ContainerFor(Foo.class)
@interface FooContainer{
Foo value(); // wrong return type
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/WrongReturnTypeForValue.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/WrongReturnTypeForValue.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,3 +1,4 @@
-WrongReturnTypeForValue.java:22:1: compiler.err.invalid.containedby.annotation.value.return: FooContainer, Foo, Foo[]
-WrongReturnTypeForValue.java:22:6: compiler.err.invalid.containedby.annotation.value.return: FooContainer, Foo, Foo[]
-2 errors
+WrongReturnTypeForValue.java:20:1: compiler.err.invalid.repeatable.annotation.value.return: FooContainer, Foo, Foo[]
+WrongReturnTypeForValue.java:20:6: compiler.err.invalid.repeatable.annotation.value.return: FooContainer, Foo, Foo[]
+WrongReturnTypeForValue.java:11:1: compiler.err.invalid.repeatable.annotation.value.return: FooContainer, Foo, Foo[]
+3 errors
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/BasicSyntaxCombo.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/BasicSyntaxCombo.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -163,9 +163,8 @@
String replaceStr = "/*"+type+"*/";
StringBuilder annoData = new StringBuilder();
annoData.append(Helper.ContentVars.IMPORTCONTAINERSTMTS.getVal())
- .append(Helper.ContentVars.CONTAINERFOR.getVal())
.append(Helper.ContentVars.CONTAINER.getVal())
- .append(Helper.ContentVars.CONTAINEDBY.getVal())
+ .append(Helper.ContentVars.REPEATABLE.getVal())
.append(Helper.ContentVars.BASE.getVal());
JavaFileObject pkgInfoFile = null;
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/DeprecatedAnnoCombo.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/DeprecatedAnnoCombo.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -115,24 +115,21 @@
switch(className) {
case "DeprecatedonBoth":
annoData.append(Helper.ContentVars.DEPRECATED.getVal())
- .append(Helper.ContentVars.CONTAINERFOR.getVal())
.append(Helper.ContentVars.CONTAINER.getVal())
.append(Helper.ContentVars.DEPRECATED.getVal())
- .append(Helper.ContentVars.CONTAINEDBY.getVal())
+ .append(Helper.ContentVars.REPEATABLE.getVal())
.append(Helper.ContentVars.BASE.getVal());
break;
case "DeprecatedonBase":
- annoData.append(Helper.ContentVars.CONTAINERFOR.getVal())
- .append(Helper.ContentVars.CONTAINER.getVal())
+ annoData.append(Helper.ContentVars.CONTAINER.getVal())
.append(Helper.ContentVars.DEPRECATED.getVal())
- .append(Helper.ContentVars.CONTAINEDBY.getVal())
+ .append(Helper.ContentVars.REPEATABLE.getVal())
.append(Helper.ContentVars.BASE.getVal());
break;
case "DeprecatedonContainer":
annoData.append(Helper.ContentVars.DEPRECATED.getVal())
- .append(Helper.ContentVars.CONTAINERFOR.getVal())
.append(Helper.ContentVars.CONTAINER.getVal())
- .append(Helper.ContentVars.CONTAINEDBY.getVal())
+ .append(Helper.ContentVars.REPEATABLE.getVal())
.append(Helper.ContentVars.BASE.getVal());
break;
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/DocumentedAnnoCombo.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/DocumentedAnnoCombo.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -93,17 +93,15 @@
switch(className) {
case "DocumentedonBothAnno":
annoData.append(Helper.ContentVars.DOCUMENTED.getVal())
- .append(Helper.ContentVars.CONTAINERFOR.getVal())
.append(Helper.ContentVars.CONTAINER.getVal())
.append(Helper.ContentVars.DOCUMENTED.getVal())
- .append(Helper.ContentVars.CONTAINEDBY.getVal())
+ .append(Helper.ContentVars.REPEATABLE.getVal())
.append(Helper.ContentVars.BASE.getVal());
break;
case "DocumentedonContainer":
annoData.append(Helper.ContentVars.DOCUMENTED.getVal())
- .append(Helper.ContentVars.CONTAINERFOR.getVal())
.append(Helper.ContentVars.CONTAINER.getVal())
- .append(Helper.ContentVars.CONTAINEDBY.getVal())
+ .append(Helper.ContentVars.REPEATABLE.getVal())
.append(Helper.ContentVars.BASE.getVal());
break;
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,15 +34,13 @@
public class Helper {
enum ContentVars {
- IMPORTCONTAINERSTMTS("\nimport java.lang.annotation.ContainedBy;\n" +
- "\nimport java.lang.annotation.ContainerFor;\n"),
+ IMPORTCONTAINERSTMTS("\nimport java.lang.annotation.Repeatable;\n"),
IMPORTDEPRECATED("import java.lang.Deprecated;\n"),
IMPORTDOCUMENTED("import java.lang.annotation.Documented;\n"),
IMPORTINHERITED("import java.lang.annotation.Inherited;\n"),
IMPORTRETENTION("import java.lang.annotation.Retention;\n" +
"\nimport java.lang.annotation.RetentionPolicy;\n"),
- CONTAINEDBY("\n@ContainedBy(FooContainer.class)\n"),
- CONTAINERFOR("@ContainerFor(Foo.class)\n"),
+ REPEATABLE("\n@Repeatable(FooContainer.class)\n"),
CONTAINER("@interface FooContainer {\n" +" Foo[] value();\n}\n"),
BASE("@interface Foo {}\n"),
REPEATABLEANNO("\n@Foo() @Foo()"),
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/InheritedAnnoCombo.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/InheritedAnnoCombo.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -94,17 +94,15 @@
switch(className) {
case "InheritedonBothAnno":
annoData.append(Helper.ContentVars.INHERITED.getVal())
- .append(Helper.ContentVars.CONTAINERFOR.getVal())
.append(Helper.ContentVars.CONTAINER.getVal())
.append(Helper.ContentVars.INHERITED.getVal())
- .append(Helper.ContentVars.CONTAINEDBY.getVal())
+ .append(Helper.ContentVars.REPEATABLE.getVal())
.append(Helper.ContentVars.BASE.getVal());
break;
case "InheritedonBase":
annoData.append(Helper.ContentVars.INHERITED.getVal())
- .append(Helper.ContentVars.CONTAINERFOR.getVal())
.append(Helper.ContentVars.CONTAINER.getVal())
- .append(Helper.ContentVars.CONTAINEDBY.getVal())
+ .append(Helper.ContentVars.REPEATABLE.getVal())
.append(Helper.ContentVars.BASE.getVal());
break;
}
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/RetentionAnnoCombo.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/RetentionAnnoCombo.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -120,7 +120,7 @@
new DiagnosticCollector<JavaFileObject>();
boolean ok = compileCode(className, contents, diagnostics);
- String expectedErrKey = "compiler.err.invalid.containedby" +
+ String expectedErrKey = "compiler.err.invalid.repeatable" +
".annotation.retention";
if (!shouldCompile && !ok) {
for (Diagnostic<?> d : diagnostics.getDiagnostics()) {
@@ -175,10 +175,9 @@
StringBuilder annoData = new StringBuilder();
annoData.append(Helper.ContentVars.IMPORTCONTAINERSTMTS.getVal())
.append(Helper.ContentVars.IMPORTRETENTION.getVal())
- .append(Helper.ContentVars.CONTAINERFOR.getVal())
.append(replacedRetCAVal)
.append(Helper.ContentVars.CONTAINER.getVal())
- .append(Helper.ContentVars.CONTAINEDBY.getVal())
+ .append(Helper.ContentVars.REPEATABLE.getVal())
.append(replacedRetBaseVal)
.append(Helper.ContentVars.BASE.getVal());
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt Wed Jan 16 12:14:29 2013 -0800
@@ -1,13 +1,14 @@
compiler.err.already.annotated # internal compiler error?
compiler.err.already.defined.this.unit # seems to be masked by compiler.err.duplicate.class
compiler.err.annotation.value.not.allowable.type # cannot happen: precluded by complete type-specific tests
+compiler.err.bad.functional.intf.anno # seems to be masked by compiler.err.annotation.type.not.applicable
compiler.err.cant.read.file # (apt.JavaCompiler?)
compiler.err.cant.select.static.class.from.param.type
compiler.err.dc.unterminated.string # cannot happen
compiler.err.illegal.char.for.encoding
-compiler.err.invalid.containedby.annotation # should not happen
-compiler.err.invalid.containedby.annotation.invalid.value # "can't" happen
-compiler.err.invalid.containedby.annotation.multiple.values # can't happen
+compiler.err.invalid.repeatable.annotation # should not happen
+compiler.err.invalid.repeatable.annotation.invalid.value # "can't" happen
+compiler.err.invalid.repeatable.annotation.multiple.values # can't happen
compiler.err.io.exception # (javah.JavahTask?)
compiler.err.limit.code # Code
compiler.err.limit.code.too.large.for.try.stmt # Gen
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/BadFunctionalIntfAnno.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+// key: compiler.err.bad.functional.intf.anno.1
+// key: compiler.misc.not.a.functional.intf
+
+@FunctionalInterface
+class BadFunctionalIntfAnno { }
--- a/langtools/test/tools/javac/diags/examples/ContainedByDocumentedMismatch.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.not.documented
-
-import java.lang.annotation.*;
-
-@Documented
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { Anno[] value(); }
-
-@Anno
-@Anno
-class ContainedByDocumentedMismatch { }
--- a/langtools/test/tools/javac/diags/examples/ContainedByInheritedMismatch.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.not.inherited
-
-import java.lang.annotation.*;
-
-@Inherited
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { Anno[] value(); }
-
-@Anno
-@Anno
-class ContainedByInheritedMismatch { }
--- a/langtools/test/tools/javac/diags/examples/ContainedByNoValue.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.no.value
-
-import java.lang.annotation.*;
-
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos {}
-
-@Anno
-@Anno
-class ContainedByNoValue { }
--- a/langtools/test/tools/javac/diags/examples/ContainedByNonDefault.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.elem.nondefault
-
-import java.lang.annotation.*;
-
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { Anno[] value(); String foo(); }
-
-class ContainedByNonDefault { }
--- a/langtools/test/tools/javac/diags/examples/ContainedByRetentionMismatch.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.retention
-
-import java.lang.annotation.*;
-
-@Retention(RetentionPolicy.RUNTIME)
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { Anno[] value(); }
-
-@Anno
-@Anno
-class ContainedByRetentionMismatch { }
--- a/langtools/test/tools/javac/diags/examples/ContainedByTargetMismatch.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.incompatible.target
-
-import java.lang.annotation.*;
-
-@ContainedBy(Annos.class)
-@Target(ElementType.METHOD)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { Anno[] value(); }
-
-class ContainedByTargetMismatch { }
--- a/langtools/test/tools/javac/diags/examples/ContainedByWrongValueType.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.value.return
-
-import java.lang.annotation.*;
-
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { String value(); }
-
-@Anno
-@Anno
-class ContainedByWrongValueType { }
--- a/langtools/test/tools/javac/diags/examples/InvalidDuplicateAnnotation.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/diags/examples/InvalidDuplicateAnnotation.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -22,17 +22,16 @@
*/
// key: compiler.err.duplicate.annotation.invalid.repeated
-// key: compiler.err.invalid.containedby.annotation.elem.nondefault
-//
+// key: compiler.err.invalid.repeatable.annotation.elem.nondefault
+
// We need an almost valid containing annotation. The easiest way to get
// one close enough to valid is by forgetting a default.
import java.lang.annotation.*;
-@ContainedBy(Annos.class)
+@Repeatable(Annos.class)
@interface Anno { }
-@ContainerFor(Anno.class)
@interface Annos { Anno[] value(); String foo(); }
@Anno
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatableDocumentedMismatch.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012, 2013, 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.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.not.documented
+
+import java.lang.annotation.*;
+
+@Documented
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos { Anno[] value(); }
+
+@Anno
+@Anno
+class RepeatableDocumentedMismatch { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatableInheritedMismatch.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012, 2013, 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.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.not.inherited
+
+import java.lang.annotation.*;
+
+@Inherited
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos { Anno[] value(); }
+
+@Anno
+@Anno
+class RepeatableInheritedMismatch { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatableNoValue.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2012, 2013, 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.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.no.value
+
+import java.lang.annotation.*;
+
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos {}
+
+@Anno
+@Anno
+class RepeatableNoValue { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatableNonDefault.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, 2013, 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.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.elem.nondefault
+
+import java.lang.annotation.*;
+
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos { Anno[] value(); String foo(); }
+
+class RepeatableNonDefault { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatableRetentionMismatch.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012, 2013, 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.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.retention
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos { Anno[] value(); }
+
+@Anno
+@Anno
+class RepeatableRetentionMismatch { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatableTargetMismatch.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2012, 2013, 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.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.incompatible.target
+
+import java.lang.annotation.*;
+
+@Repeatable(Annos.class)
+@Target(ElementType.METHOD)
+@interface Anno { }
+
+@interface Annos { Anno[] value(); }
+
+class RepeatableTargetMismatch { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatableWrongValueType.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2012, 2013, 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.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.value.return
+
+import java.lang.annotation.*;
+
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos { String value(); }
+
+@Anno
+@Anno
+class RepeatableWrongValueType { }
--- a/langtools/test/tools/javac/diags/examples/RepeatingAnnotationAndContainer.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/diags/examples/RepeatingAnnotationAndContainer.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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,14 +21,13 @@
* questions.
*/
-// key: compiler.err.invalid.containedby.annotation.repeated.and.container.present
+// key: compiler.err.invalid.repeatable.annotation.repeated.and.container.present
import java.lang.annotation.*;
-@ContainedBy(Annos.class)
+@Repeatable(Annos.class)
@interface Anno { }
-@ContainerFor(Anno.class)
@interface Annos { Anno[] value(); }
@Anno
--- a/langtools/test/tools/javac/diags/examples/WrongContainedBy.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-// key: compiler.err.invalid.container.no.containerfor
-// key: compiler.err.invalid.container.wrong.containedby
-
-import java.lang.annotation.*;
-
-@ContainerFor(WrongContainedBy.class)
-@interface Foos {
- WrongContainedBy[] value();
-}
-
-@ContainedBy(Target.class)
-public @interface WrongContainedBy {}
--- a/langtools/test/tools/javac/diags/examples/WrongContainerFor.java Wed Jul 05 18:36:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-// key: compiler.err.invalid.container.wrong.containerfor
-// key: compiler.err.invalid.container.no.containedby
-
-import java.lang.annotation.*;
-
-@ContainerFor(Retention.class)
-@interface Foos {
- WrongContainerFor[] value();
-}
-
-@ContainedBy(Foos.class)
-public @interface WrongContainerFor {}
--- a/langtools/test/tools/javac/lambda/BadConv03.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/BadConv03.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,2 +1,2 @@
-BadConv03.java:19:11: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, BadConv03.B))
+BadConv03.java:19:11: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: BadConv03.B, (compiler.misc.incompatible.abstracts: kindname.interface, BadConv03.B))
1 error
--- a/langtools/test/tools/javac/lambda/BadLambdaPos.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/BadLambdaPos.out Wed Jan 16 12:14:29 2013 -0800
@@ -4,6 +4,6 @@
BadLambdaPos.java:23:18: compiler.err.unexpected.lambda
BadLambdaPos.java:23:34: compiler.err.unexpected.lambda
BadLambdaPos.java:24:21: compiler.err.unexpected.lambda
-BadLambdaPos.java:28:22: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-BadLambdaPos.java:29:28: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+BadLambdaPos.java:28:22: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+BadLambdaPos.java:29:28: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
8 errors
--- a/langtools/test/tools/javac/lambda/BadTargetType.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/BadTargetType.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
-BadTargetType.java:16:24: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-BadTargetType.java:17:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-BadTargetType.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, java.lang.Object, @460, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf))
-BadTargetType.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, java.lang.Object, @489, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf))
+BadTargetType.java:16:24: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+BadTargetType.java:17:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+BadTargetType.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, java.lang.Object, @460, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
+BadTargetType.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, java.lang.Object, @489, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
4 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/FunctionalInterfaceAnno.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,33 @@
+/*
+ * @test /nodynamiccopyright/
+ * @summary smoke test for functional interface annotation
+ * @compile/fail/ref=FunctionalInterfaceAnno.out -XDrawDiagnostics FunctionalInterfaceAnno.java
+ */
+class FunctionalInterfaceAnno {
+ @FunctionalInterface
+ static class A { } //not an interface
+
+ @FunctionalInterface
+ static abstract class B { } //not an interface
+
+ @FunctionalInterface
+ enum C { } //not an interface
+
+ @FunctionalInterface
+ @interface D { } //not an interface
+
+ @FunctionalInterface
+ interface E { } //no abstracts
+
+ @FunctionalInterface
+ interface F { default void m() { } } //no abstracts
+
+ @FunctionalInterface
+ interface G { String toString(); } //no abstracts
+
+ @FunctionalInterface
+ interface H { void m(); void n(); } //incompatible abstracts
+
+ @FunctionalInterface
+ interface I { void m(); } //ok
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/FunctionalInterfaceAnno.out Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,9 @@
+FunctionalInterfaceAnno.java:7:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf: FunctionalInterfaceAnno.A)
+FunctionalInterfaceAnno.java:10:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf: FunctionalInterfaceAnno.B)
+FunctionalInterfaceAnno.java:13:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf: FunctionalInterfaceAnno.C)
+FunctionalInterfaceAnno.java:16:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf: FunctionalInterfaceAnno.D)
+FunctionalInterfaceAnno.java:19:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf.1: FunctionalInterfaceAnno.E, (compiler.misc.no.abstracts: kindname.interface, FunctionalInterfaceAnno.E))
+FunctionalInterfaceAnno.java:22:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf.1: FunctionalInterfaceAnno.F, (compiler.misc.no.abstracts: kindname.interface, FunctionalInterfaceAnno.F))
+FunctionalInterfaceAnno.java:25:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf.1: FunctionalInterfaceAnno.G, (compiler.misc.no.abstracts: kindname.interface, FunctionalInterfaceAnno.G))
+FunctionalInterfaceAnno.java:28:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf.1: FunctionalInterfaceAnno.H, (compiler.misc.incompatible.abstracts: kindname.interface, FunctionalInterfaceAnno.H))
+8 errors
--- a/langtools/test/tools/javac/lambda/Intersection01.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/Intersection01.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,3 +1,3 @@
-Intersection01.java:36:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
-Intersection01.java:38:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
+Intersection01.java:36:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: java.io.Serializable, (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
+Intersection01.java:38:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: java.io.Serializable, (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
2 errors
--- a/langtools/test/tools/javac/lambda/LambdaConv09.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/LambdaConv09.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
-LambdaConv09.java:42:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo1))
-LambdaConv09.java:43:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo2))
-LambdaConv09.java:44:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo3))
-LambdaConv09.java:46:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo5))
+LambdaConv09.java:42:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: LambdaConv09.Foo1, (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo1))
+LambdaConv09.java:43:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: LambdaConv09.Foo2, (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo2))
+LambdaConv09.java:44:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: LambdaConv09.Foo3, (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo3))
+LambdaConv09.java:46:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: LambdaConv09.Foo5, (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo5))
4 errors
--- a/langtools/test/tools/javac/lambda/LambdaExpr10.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/LambdaExpr10.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,9 +1,9 @@
-LambdaExpr10.java:18:28: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-LambdaExpr10.java:19:32: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-LambdaExpr10.java:23:40: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-LambdaExpr10.java:24:46: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-LambdaExpr10.java:28:29: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-LambdaExpr10.java:29:33: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+LambdaExpr10.java:18:28: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+LambdaExpr10.java:19:32: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+LambdaExpr10.java:23:40: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+LambdaExpr10.java:24:46: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+LambdaExpr10.java:28:29: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+LambdaExpr10.java:29:33: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
LambdaExpr10.java:33:35: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, void))
LambdaExpr10.java:34:49: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, void))
8 errors
--- a/langtools/test/tools/javac/lambda/MethodReference04.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/MethodReference04.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,2 +1,2 @@
-MethodReference04.java:13:16: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+MethodReference04.java:13:16: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MethodReference59.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012, 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 8004102
+ * @summary Add support for array constructor references
+ */
+public class MethodReference59 {
+
+ static int assertionCount = 0;
+
+ static void assertTrue(boolean cond) {
+ assertionCount++;
+ if (!cond)
+ throw new AssertionError();
+ }
+
+ interface ArrayFactory<X> {
+ X make(int size);
+ }
+
+ public static void main(String[] args) {
+ ArrayFactory<int[]> factory1 = int[]::new;
+ int[] i1 = factory1.make(5);
+ assertTrue(i1.length == 5);
+ ArrayFactory<int[][]> factory2 = int[][]::new;
+ int[][] i2 = factory2.make(5);
+ assertTrue(i2.length == 5);
+ assertTrue(assertionCount == 2);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MethodReference60.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012, 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 8004102
+ * @summary Add support for array constructor references
+ * @compile/fail/ref=MethodReference60.out -XDrawDiagnostics MethodReference60.java
+ */
+public class MethodReference60 {
+
+ interface ArrayFactory<X> {
+ X make(int size);
+ }
+
+ interface BadArrayFactory1<X> {
+ X make();
+ }
+
+ interface BadArrayFactory2<X> {
+ X make(int i1, int i2);
+ }
+
+ interface BadArrayFactory3<X> {
+ X make(String s);
+ }
+
+ public static void main(String[] args) {
+ BadArrayFactory1<int[]> factory1 = int[]::new; //param mismatch
+ BadArrayFactory2<int[]> factory2 = int[]::new; //param mismatch
+ BadArrayFactory3<int[]> factory3 = int[]::new; //param mismatch
+ ArrayFactory<Integer> factory4 = int[]::new; //return type mismatch
+ ArrayFactory<Integer[]> factory5 = int[]::new; //return type mismatch
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MethodReference60.out Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,6 @@
+MethodReference60.java:49:44: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Array, int, compiler.misc.no.args, kindname.class, Array, (compiler.misc.arg.length.mismatch)))
+MethodReference60.java:50:44: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Array, int, int,int, kindname.class, Array, (compiler.misc.arg.length.mismatch)))
+MethodReference60.java:51:44: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Array, int, java.lang.String, kindname.class, Array, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, int))))
+MethodReference60.java:52:42: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.mref: (compiler.misc.inconvertible.types: int[], java.lang.Integer))
+MethodReference60.java:53:44: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.mref: (compiler.misc.inconvertible.types: int[], java.lang.Integer[]))
+5 errors
--- a/langtools/test/tools/javac/lambda/TargetType17.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/TargetType17.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,9 +1,9 @@
-TargetType17.java:14:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:15:23: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:16:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:17:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:18:23: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:19:25: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:20:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:21:27: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+TargetType17.java:14:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: byte)
+TargetType17.java:15:23: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: short)
+TargetType17.java:16:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: int)
+TargetType17.java:17:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: long)
+TargetType17.java:18:23: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: float)
+TargetType17.java:19:25: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: double)
+TargetType17.java:20:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: char)
+TargetType17.java:21:27: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: boolean)
8 errors
--- a/langtools/test/tools/javac/lambda/TargetType43.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/TargetType43.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
-TargetType43.java:13:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+TargetType43.java:13:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
TargetType43.java:13:30: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, TargetType43, null)
-TargetType43.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m, java.lang.Object, @359, kindname.class, TargetType43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf))
+TargetType43.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m, java.lang.Object, @359, kindname.class, TargetType43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
TargetType43.java:14:21: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, TargetType43, null)
4 errors
--- a/langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest2_neg1.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest2_neg1.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,2 +1,2 @@
-LambdaTest2_neg1.java:15:13: compiler.err.cant.apply.symbol: kindname.method, methodQooRoo, QooRoo<java.lang.Integer,java.lang.Integer,java.lang.Void>, @531, kindname.class, LambdaTest2_neg1, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, QooRoo)))
+LambdaTest2_neg1.java:15:13: compiler.err.cant.apply.symbol: kindname.method, methodQooRoo, QooRoo<java.lang.Integer,java.lang.Integer,java.lang.Void>, @531, kindname.class, LambdaTest2_neg1, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf.1: QooRoo, (compiler.misc.incompatible.abstracts: kindname.interface, QooRoo)))
1 error
--- a/langtools/test/tools/javac/lambda/funcInterfaces/NonSAM1.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/funcInterfaces/NonSAM1.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,2 +1,2 @@
-NonSAM1.java:11:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, Planet))
+NonSAM1.java:11:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: Planet, (compiler.misc.no.abstracts: kindname.interface, Planet))
1 error
--- a/langtools/test/tools/javac/lambda/funcInterfaces/NonSAM3.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/funcInterfaces/NonSAM3.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,9 +1,9 @@
-NonSAM3.java:15:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, FooBar))
-NonSAM3.java:16:22: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, FooBar))
-NonSAM3.java:17:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
-NonSAM3.java:18:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
-NonSAM3.java:19:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
-NonSAM3.java:20:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
-NonSAM3.java:21:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
-NonSAM3.java:22:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:15:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: FooBar, (compiler.misc.incompatible.abstracts: kindname.interface, FooBar))
+NonSAM3.java:16:22: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: FooBar, (compiler.misc.incompatible.abstracts: kindname.interface, FooBar))
+NonSAM3.java:17:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:18:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:19:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:20:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:21:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:22:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
8 errors
--- a/langtools/test/tools/javac/lambda/lambdaExpression/AbstractClass_neg.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/lambdaExpression/AbstractClass_neg.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,2 +1,2 @@
-AbstractClass_neg.java:16:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+AbstractClass_neg.java:16:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: AbstractClass_neg.SAM)
1 error
--- a/langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression5.out Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression5.out Wed Jan 16 12:14:29 2013 -0800
@@ -1,2 +1,2 @@
-InvalidExpression5.java:12:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+InvalidExpression5.java:12:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
1 error
--- a/langtools/test/tools/javadoc/6958836/Test.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javadoc/6958836/Test.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, 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,6 +61,7 @@
// Force en_US locale in lieu of something like -XDrawDiagnostics.
// For some reason, this must be the first option when used.
opts.addAll(list("-locale", "en_US"));
+ opts.add("-Xdoclint:none");
opts.addAll(list("-classpath", System.getProperty("test.src")));
opts.addAll(list("-d", testOutDir.getPath()));
opts.addAll(testOpts);
--- a/langtools/test/tools/javadoc/6964914/Test.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javadoc/6964914/Test.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, 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,6 +45,7 @@
void javadoc(String path, String expect) {
File testSrc = new File(System.getProperty("test.src"));
String[] args = {
+ "-Xdoclint:none",
"-source", "1.4", // enables certain Parser warnings
"-bootclasspath", System.getProperty("sun.boot.class.path"),
"-classpath", ".",
--- a/langtools/test/tools/javadoc/6964914/TestStdDoclet.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javadoc/6964914/TestStdDoclet.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, 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
@@ -57,6 +57,7 @@
Process p = new ProcessBuilder()
.command(javadoc.getPath(),
"-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"),
+ "-Xdoclint:none",
"-package",
new File(testSrc, thisClassName + ".java").getPath())
.redirectErrorStream(true)
--- a/langtools/test/tools/javadoc/MaxWarns.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javadoc/MaxWarns.java Wed Jan 16 12:14:29 2013 -0800
@@ -74,7 +74,7 @@
String javadoc(File f) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
- String[] args = { "-d", "api", f.getPath() };
+ String[] args = { "-Xdoclint:none", "-d", "api", f.getPath() };
int rc = com.sun.tools.javadoc.Main.execute("javadoc", pw, pw, pw,
com.sun.tools.doclets.standard.Standard.class.getName(), args);
pw.flush();
--- a/langtools/test/tools/javadoc/T6551367.java Wed Jul 05 18:36:11 2017 +0200
+++ b/langtools/test/tools/javadoc/T6551367.java Wed Jan 16 12:14:29 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
File source = new File(testSrc, file);
int rc = execute("javadoc", "T6551367",
T6551367.class.getClassLoader(),
- new String[]{source.getPath(), "-d", destDir.getAbsolutePath()});
+ new String[]{"-Xdoclint:none", source.getPath(), "-d", destDir.getAbsolutePath()});
if (rc != 0)
throw new Error("unexpected exit from javadoc: " + rc);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javadoc/doclint/DocLintTest.java Wed Jan 16 12:14:29 2013 -0800
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2012, 2013, 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 8004834
+ * @summary Add doclint support into javadoc
+ */
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.tools.Diagnostic;
+import javax.tools.DocumentationTool;
+import javax.tools.DocumentationTool.DocumentationTask;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+import static javax.tools.Diagnostic.Kind.*;
+
+import com.sun.tools.javac.main.Main;
+
+public class DocLintTest {
+ public static void main(String... args) throws Exception {
+ new DocLintTest().run();
+ }
+
+ DocumentationTool javadoc;
+ StandardJavaFileManager fm;
+ JavaFileObject file;
+
+ final String code =
+ /* 01 */ "/** Class comment. */\n" +
+ /* 02 */ "public class Test {\n" +
+ /* 03 */ " /** Method comment. */\n" +
+ /* 04 */ " public void method() { }\n" +
+ /* 05 */ "\n" +
+ /* 06 */ " /** Syntax < error. */\n" +
+ /* 07 */ " private void syntaxError() { }\n" +
+ /* 08 */ "\n" +
+ /* 09 */ " /** @see DoesNotExist */\n" +
+ /* 10 */ " protected void referenceError() { }\n" +
+ /* 11 */ "\n" +
+ /* 12 */ " /** @return */\n" +
+ /* 13 */ " public int emptyReturn() { return 0; }\n" +
+ /* 14 */ "}\n";
+
+ private final String rawDiags = "-XDrawDiagnostics";
+
+ private enum Message {
+ // doclint messages
+ DL_ERR6(ERROR, "Test.java:6:16: compiler.err.proc.messager: malformed HTML"),
+ DL_ERR9(ERROR, "Test.java:9:14: compiler.err.proc.messager: reference not found"),
+ DL_WRN12(WARNING, "Test.java:12:9: compiler.warn.proc.messager: no description for @return"),
+
+ // doclint messages when -XDrawDiagnostics is not in effect
+ DL_ERR9A(ERROR, "Test.java:9: error: reference not found"),
+ DL_WRN12A(WARNING, "Test.java:12: warning: no description for @return"),
+
+ // javadoc messages about bad content: these should only appear when doclint is disabled
+ JD_WRN10(WARNING, "Test.java:10: warning - Tag @see: reference not found: DoesNotExist"),
+ JD_WRN13(WARNING, "Test.java:13: warning - @return tag has no arguments."),
+
+ // javadoc messages for bad options
+ OPT_BADARG(ERROR, "javadoc: error - Invalid argument for -Xdoclint option"),
+ OPT_BADQUAL(ERROR, "javadoc: error - Access qualifiers not permitted for -Xdoclint arguments");
+
+ final Diagnostic.Kind kind;
+ final String text;
+
+ static Message get(String text) {
+ for (Message m: values()) {
+ if (m.text.equals(text))
+ return m;
+ }
+ return null;
+ }
+
+ Message(Diagnostic.Kind kind, String text) {
+ this.kind = kind;
+ this.text = text;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + kind + ",\"" + text + "\"]";
+ }
+ }
+
+ void run() throws Exception {
+ javadoc = ToolProvider.getSystemDocumentationTool();
+ fm = javadoc.getStandardFileManager(null, null, null);
+ fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
+ file = new SimpleJavaFileObject(URI.create("Test.java"), JavaFileObject.Kind.SOURCE) {
+ @Override
+ public CharSequence getCharContent(boolean ignoreEncoding) {
+ return code;
+ }
+ };
+
+ test(Collections.<String>emptyList(),
+ Main.Result.ERROR,
+ EnumSet.of(Message.DL_ERR9A, Message.DL_WRN12A));
+
+ test(Arrays.asList(rawDiags),
+ Main.Result.ERROR,
+ EnumSet.of(Message.DL_ERR9, Message.DL_WRN12));
+
+ test(Arrays.asList("-Xdoclint:none"),
+ Main.Result.OK,
+ EnumSet.of(Message.JD_WRN10, Message.JD_WRN13));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.DL_ERR9, Message.DL_WRN12));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint:all/public"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.OPT_BADQUAL));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint:all", "-public"),
+ Main.Result.OK,
+ EnumSet.of(Message.DL_WRN12));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint:syntax"),
+ Main.Result.OK,
+ EnumSet.of(Message.DL_WRN12));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint:syntax", "-private"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint:reference"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.DL_ERR9));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint:badarg"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.OPT_BADARG));
+
+ if (errors > 0)
+ throw new Exception(errors + " errors occurred");
+ }
+
+ void test(List<String> opts, Main.Result expectResult, Set<Message> expectMessages) {
+ System.err.println("test: " + opts);
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ List<JavaFileObject> files = Arrays.asList(file);
+ try {
+ DocumentationTask t = javadoc.getTask(pw, fm, null, null, opts, files);
+ boolean ok = t.call();
+ pw.close();
+ String out = sw.toString().replaceAll("[\r\n]+", "\n");
+ if (!out.isEmpty())
+ System.err.println(out);
+ if (ok && expectResult != Main.Result.OK) {
+ error("Compilation succeeded unexpectedly");
+ } else if (!ok && expectResult != Main.Result.ERROR) {
+ error("Compilation failed unexpectedly");
+ } else
+ check(out, expectMessages);
+ } catch (IllegalArgumentException e) {
+ System.err.println(e);
+ String expectOut = expectMessages.iterator().next().text;
+ if (expectResult != Main.Result.CMDERR)
+ error("unexpected exception caught");
+ else if (!e.getMessage().equals(expectOut)) {
+ error("unexpected exception message: "
+ + e.getMessage()
+ + " expected: " + expectOut);
+ }
+ }
+
+// if (errors > 0)
+// throw new Error("stop");
+ }
+
+ private void check(String out, Set<Message> expect) {
+ Pattern ignore = Pattern.compile("^(Building|Constructing|Generating|Loading|Standard|Starting| ) .*");
+ Pattern stats = Pattern.compile("^([1-9]+) (error|warning)(s?)");
+ Set<Message> found = EnumSet.noneOf(Message.class);
+ int e = 0, w = 0;
+ for (String line: out.split("[\r\n]+")) {
+ if (ignore.matcher(line).matches())
+ continue;
+
+ Matcher s = stats.matcher(line);
+ if (s.matches()) {
+ int i = Integer.valueOf(s.group(1));
+ if (s.group(2).equals("error"))
+ e++;
+ else
+ w++;
+ continue;
+ }
+
+ Message m = Message.get(line);
+ if (m == null)
+ error("Unexpected line: " + line);
+ else
+ found.add(m);
+ }
+ for (Message m: expect) {
+ if (!found.contains(m))
+ error("expected message not found: " + m.text);
+ }
+ for (Message m: found) {
+ if (!expect.contains(m))
+ error("unexpected message found: " + m.text);
+ }
+ }
+
+ void error(String msg) {
+ System.err.println("Error: " + msg);
+ errors++;
+ }
+
+ int errors;
+}