mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8006119: update javac to follow latest spec for repeatable annotations
Reviewed-by: darcy
This commit is contained in:
parent
9e3a121357
commit
a2f594bf74
71 changed files with 243 additions and 675 deletions
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -126,12 +126,12 @@ public class Annotations {
|
||||||
//
|
//
|
||||||
// We need to do this in two passes because when creating
|
// We need to do this in two passes because when creating
|
||||||
// a container for a repeating annotation we must
|
// 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
|
// contained annotation is fully annotated
|
||||||
//
|
//
|
||||||
// The way we force this order is to do all repeating
|
// The way we force this order is to do all repeating
|
||||||
// annotations in a pass after all non-repeating are
|
// 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
|
// is non-repeating and therefore will be annotated in the
|
||||||
// fist pass.
|
// fist pass.
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ public class Annotations {
|
||||||
// its contained annotation.
|
// its contained annotation.
|
||||||
ListBuffer<Attribute.Compound> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
|
ListBuffer<Attribute.Compound> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
|
||||||
if (manualContainer != null) {
|
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);
|
manualContainer.first().type.tsym);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -161,8 +161,7 @@ public class Symtab {
|
||||||
public final Type autoCloseableType;
|
public final Type autoCloseableType;
|
||||||
public final Type trustMeType;
|
public final Type trustMeType;
|
||||||
public final Type lambdaMetafactory;
|
public final Type lambdaMetafactory;
|
||||||
public final Type containedByType;
|
public final Type repeatableType;
|
||||||
public final Type containerForType;
|
|
||||||
public final Type documentedType;
|
public final Type documentedType;
|
||||||
public final Type elementTypeType;
|
public final Type elementTypeType;
|
||||||
|
|
||||||
|
@ -494,8 +493,7 @@ public class Symtab {
|
||||||
deprecatedType = enterClass("java.lang.Deprecated");
|
deprecatedType = enterClass("java.lang.Deprecated");
|
||||||
suppressWarningsType = enterClass("java.lang.SuppressWarnings");
|
suppressWarningsType = enterClass("java.lang.SuppressWarnings");
|
||||||
inheritedType = enterClass("java.lang.annotation.Inherited");
|
inheritedType = enterClass("java.lang.annotation.Inherited");
|
||||||
containedByType = enterClass("java.lang.annotation.ContainedBy");
|
repeatableType = enterClass("java.lang.annotation.Repeatable");
|
||||||
containerForType = enterClass("java.lang.annotation.ContainerFor");
|
|
||||||
documentedType = enterClass("java.lang.annotation.Documented");
|
documentedType = enterClass("java.lang.annotation.Documented");
|
||||||
elementTypeType = enterClass("java.lang.annotation.ElementType");
|
elementTypeType = enterClass("java.lang.annotation.ElementType");
|
||||||
systemType = enterClass("java.lang.System");
|
systemType = enterClass("java.lang.System");
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -392,7 +392,7 @@ public class Annotate {
|
||||||
List.of(p)));
|
List.of(p)));
|
||||||
|
|
||||||
if (!chk.annotationApplicable(annoTree, on))
|
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))
|
if (!chk.validateAnnotationDeferErrors(annoTree))
|
||||||
log.error(annoTree.pos(), "duplicate.annotation.invalid.repeated", origAnnoType);
|
log.error(annoTree.pos(), "duplicate.annotation.invalid.repeated", origAnnoType);
|
||||||
|
@ -414,11 +414,11 @@ public class Annotate {
|
||||||
Type origAnnoType = currentAnno.type;
|
Type origAnnoType = currentAnno.type;
|
||||||
TypeSymbol origAnnoDecl = origAnnoType.tsym;
|
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
|
// annotation's declaration, or null if it has none
|
||||||
Attribute.Compound ca = origAnnoDecl.attribute(syms.containedByType.tsym);
|
Attribute.Compound ca = origAnnoDecl.attribute(syms.repeatableType.tsym);
|
||||||
if (ca == null) { // has no ContainedBy annotation
|
if (ca == null) { // has no Repeatable annotation
|
||||||
log.error(pos, "duplicate.annotation.missing.container", origAnnoType, syms.containedByType);
|
log.error(pos, "duplicate.annotation.missing.container", origAnnoType, syms.repeatableType);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,23 +440,23 @@ public class Annotate {
|
||||||
DiagnosticPosition pos,
|
DiagnosticPosition pos,
|
||||||
TypeSymbol annoDecl)
|
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
|
// on the declaration of the annotation type that is repeating is
|
||||||
// valid.
|
// valid.
|
||||||
|
|
||||||
// ContainedBy must have at least one element
|
// Repeatable must have at least one element
|
||||||
if (ca.values.isEmpty()) {
|
if (ca.values.isEmpty()) {
|
||||||
log.error(pos, "invalid.containedby.annotation", annoDecl);
|
log.error(pos, "invalid.repeatable.annotation", annoDecl);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Pair<MethodSymbol,Attribute> p = ca.values.head;
|
Pair<MethodSymbol,Attribute> p = ca.values.head;
|
||||||
Name name = p.fst.name;
|
Name name = p.fst.name;
|
||||||
if (name != names.value) { // should contain only one element, named "value"
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
if (!(p.snd instanceof Attribute.Class)) { // check that the value of "value" is an Attribute.Class
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,13 +491,13 @@ public class Annotate {
|
||||||
}
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
log.error(pos,
|
log.error(pos,
|
||||||
"invalid.containedby.annotation.multiple.values",
|
"invalid.repeatable.annotation.multiple.values",
|
||||||
targetContainerType,
|
targetContainerType,
|
||||||
nr_value_elems);
|
nr_value_elems);
|
||||||
return null;
|
return null;
|
||||||
} else if (nr_value_elems == 0) {
|
} else if (nr_value_elems == 0) {
|
||||||
log.error(pos,
|
log.error(pos,
|
||||||
"invalid.containedby.annotation.no.value",
|
"invalid.repeatable.annotation.no.value",
|
||||||
targetContainerType);
|
targetContainerType);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -506,7 +506,7 @@ public class Annotate {
|
||||||
// probably "impossible" to fail this
|
// probably "impossible" to fail this
|
||||||
if (containerValueSymbol.kind != Kinds.MTH) {
|
if (containerValueSymbol.kind != Kinds.MTH) {
|
||||||
log.error(pos,
|
log.error(pos,
|
||||||
"invalid.containedby.annotation.invalid.value",
|
"invalid.repeatable.annotation.invalid.value",
|
||||||
targetContainerType);
|
targetContainerType);
|
||||||
fatalError = true;
|
fatalError = true;
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,7 @@ public class Annotate {
|
||||||
if (!(types.isArray(valueRetType) &&
|
if (!(types.isArray(valueRetType) &&
|
||||||
types.isSameType(expectedType, valueRetType))) {
|
types.isSameType(expectedType, valueRetType))) {
|
||||||
log.error(pos,
|
log.error(pos,
|
||||||
"invalid.containedby.annotation.value.return",
|
"invalid.repeatable.annotation.value.return",
|
||||||
targetContainerType,
|
targetContainerType,
|
||||||
valueRetType,
|
valueRetType,
|
||||||
expectedType);
|
expectedType);
|
||||||
|
@ -528,10 +528,7 @@ public class Annotate {
|
||||||
fatalError = true;
|
fatalError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicitly no check for/validity of @ContainerFor. That is
|
// The conditions for a valid containing annotation are made
|
||||||
// done on declaration of the container, and at reflect time.
|
|
||||||
|
|
||||||
// The rest of the conditions for a valid containing annotation are made
|
|
||||||
// in Check.validateRepeatedAnnotaton();
|
// in Check.validateRepeatedAnnotaton();
|
||||||
|
|
||||||
return fatalError ? null : containerValueSymbol;
|
return fatalError ? null : containerValueSymbol;
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -3844,24 +3844,14 @@ public class Attr extends JCTree.Visitor {
|
||||||
log.error(tree.typarams.head.pos(),
|
log.error(tree.typarams.head.pos(),
|
||||||
"intf.annotation.cant.have.type.params");
|
"intf.annotation.cant.have.type.params");
|
||||||
|
|
||||||
// If this annotation has a @ContainedBy, validate
|
// If this annotation has a @Repeatable, validate
|
||||||
Attribute.Compound containedBy = c.attribute(syms.containedByType.tsym);
|
Attribute.Compound repeatable = c.attribute(syms.repeatableType.tsym);
|
||||||
if (containedBy != null) {
|
if (repeatable != null) {
|
||||||
// get diagnositc position for error reporting
|
// get diagnostic position for error reporting
|
||||||
DiagnosticPosition cbPos = getDiagnosticPosition(tree, containedBy.type);
|
DiagnosticPosition cbPos = getDiagnosticPosition(tree, repeatable.type);
|
||||||
Assert.checkNonNull(cbPos);
|
Assert.checkNonNull(cbPos);
|
||||||
|
|
||||||
chk.validateContainedBy(c, containedBy, cbPos);
|
chk.validateRepeatable(c, repeatable, 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);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Check that all extended classes and interfaces
|
// Check that all extended classes and interfaces
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -2592,30 +2592,30 @@ public class Check {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate the proposed container 'containedBy' on the
|
* Validate the proposed container 'repeatable' on the
|
||||||
* annotation type symbol 's'. Report errors at position
|
* annotation type symbol 's'. Report errors at position
|
||||||
* 'pos'.
|
* 'pos'.
|
||||||
*
|
*
|
||||||
* @param s The (annotation)type declaration annotated with a @ContainedBy
|
* @param s The (annotation)type declaration annotated with a @Repeatable
|
||||||
* @param containedBy the @ContainedBy on 's'
|
* @param repeatable the @Repeatable on 's'
|
||||||
* @param pos where to report errors
|
* @param pos where to report errors
|
||||||
*/
|
*/
|
||||||
public void validateContainedBy(TypeSymbol s, Attribute.Compound containedBy, DiagnosticPosition pos) {
|
public void validateRepeatable(TypeSymbol s, Attribute.Compound repeatable, DiagnosticPosition pos) {
|
||||||
Assert.check(types.isSameType(containedBy.type, syms.containedByType));
|
Assert.check(types.isSameType(repeatable.type, syms.repeatableType));
|
||||||
|
|
||||||
Type t = null;
|
Type t = null;
|
||||||
List<Pair<MethodSymbol,Attribute>> l = containedBy.values;
|
List<Pair<MethodSymbol,Attribute>> l = repeatable.values;
|
||||||
if (!l.isEmpty()) {
|
if (!l.isEmpty()) {
|
||||||
Assert.check(l.head.fst.name == names.value);
|
Assert.check(l.head.fst.name == names.value);
|
||||||
t = ((Attribute.Class)l.head.snd).getValue();
|
t = ((Attribute.Class)l.head.snd).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
log.error(pos, "invalid.container.wrong.containedby", s, containedBy);
|
// errors should already have been reported during Annotate
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
validateHasContainerFor(t.tsym, s, pos);
|
validateValue(t.tsym, s, pos);
|
||||||
validateRetention(t.tsym, s, pos);
|
validateRetention(t.tsym, s, pos);
|
||||||
validateDocumented(t.tsym, s, pos);
|
validateDocumented(t.tsym, s, pos);
|
||||||
validateInherited(t.tsym, s, pos);
|
validateInherited(t.tsym, s, pos);
|
||||||
|
@ -2623,79 +2623,18 @@ public class Check {
|
||||||
validateDefault(t.tsym, s, pos);
|
validateDefault(t.tsym, s, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void validateValue(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) {
|
||||||
* Validate the proposed container 'containerFor' on the
|
Scope.Entry e = container.members().lookup(names.value);
|
||||||
* annotation type symbol 's'. Report errors at position
|
if (e.scope != null && e.sym.kind == MTH) {
|
||||||
* 'pos'.
|
MethodSymbol m = (MethodSymbol) e.sym;
|
||||||
*
|
Type ret = m.getReturnType();
|
||||||
* @param s The (annotation)type declaration annotated with a @ContainerFor
|
if (!(ret.hasTag(ARRAY) && types.isSameType(((ArrayType)ret).elemtype, contained.type))) {
|
||||||
* @param containerFor the @ContainedFor on 's'
|
log.error(pos, "invalid.repeatable.annotation.value.return",
|
||||||
* @param pos where to report errors
|
container, ret, types.makeArrayType(contained.type));
|
||||||
*/
|
}
|
||||||
public void validateContainerFor(TypeSymbol s, Attribute.Compound containerFor, DiagnosticPosition pos) {
|
} else {
|
||||||
Assert.check(types.isSameType(containerFor.type, syms.containerForType));
|
log.error(pos, "invalid.repeatable.annotation.no.value", container);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
private void validateRetention(Symbol container, Symbol contained, DiagnosticPosition pos) {
|
||||||
|
@ -2715,7 +2654,7 @@ public class Check {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (error ) {
|
if (error ) {
|
||||||
log.error(pos, "invalid.containedby.annotation.retention",
|
log.error(pos, "invalid.repeatable.annotation.retention",
|
||||||
container, containerRetention,
|
container, containerRetention,
|
||||||
contained, containedRetention);
|
contained, containedRetention);
|
||||||
}
|
}
|
||||||
|
@ -2724,7 +2663,7 @@ public class Check {
|
||||||
private void validateDocumented(Symbol container, Symbol contained, DiagnosticPosition pos) {
|
private void validateDocumented(Symbol container, Symbol contained, DiagnosticPosition pos) {
|
||||||
if (contained.attribute(syms.documentedType.tsym) != null) {
|
if (contained.attribute(syms.documentedType.tsym) != null) {
|
||||||
if (container.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 +2671,7 @@ public class Check {
|
||||||
private void validateInherited(Symbol container, Symbol contained, DiagnosticPosition pos) {
|
private void validateInherited(Symbol container, Symbol contained, DiagnosticPosition pos) {
|
||||||
if (contained.attribute(syms.inheritedType.tsym) != null) {
|
if (contained.attribute(syms.inheritedType.tsym) != null) {
|
||||||
if (container.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 +2691,7 @@ public class Check {
|
||||||
// contained has target, but container has not, error
|
// contained has target, but container has not, error
|
||||||
Attribute.Array containerTarget = getAttributeTargetAttribute(container);
|
Attribute.Array containerTarget = getAttributeTargetAttribute(container);
|
||||||
if (containerTarget == null) {
|
if (containerTarget == null) {
|
||||||
log.error(pos, "invalid.containedby.annotation.incompatible.target", container, contained);
|
log.error(pos, "invalid.repeatable.annotation.incompatible.target", container, contained);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2775,7 +2714,7 @@ public class Check {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isTargetSubset(containedTargets, containerTargets)) {
|
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 +2748,7 @@ public class Check {
|
||||||
elm.kind == Kinds.MTH &&
|
elm.kind == Kinds.MTH &&
|
||||||
((MethodSymbol)elm).defaultValue == null) {
|
((MethodSymbol)elm).defaultValue == null) {
|
||||||
log.error(pos,
|
log.error(pos,
|
||||||
"invalid.containedby.annotation.elem.nondefault",
|
"invalid.repeatable.annotation.elem.nondefault",
|
||||||
container,
|
container,
|
||||||
elm);
|
elm);
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,13 +261,13 @@ public class JavacElements implements Elements {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed to unpack the runtime view of containing annotations
|
// Needed to unpack the runtime view of containing annotations
|
||||||
private static final Class<? extends Annotation> CONTAINED_BY_CLASS = initContainedBy();
|
private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable();
|
||||||
private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod();
|
private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod();
|
||||||
|
|
||||||
private static Class<? extends Annotation> initContainedBy() {
|
private static Class<? extends Annotation> initRepeatable() {
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("unchecked") // java.lang.annotation.ContainedBy extends Annotation by being an annotation type
|
@SuppressWarnings("unchecked") // java.lang.annotation.Repeatable extends Annotation by being an annotation type
|
||||||
Class<? extends Annotation> c = (Class)Class.forName("java.lang.annotation.ContainedBy");
|
Class<? extends Annotation> c = (Class)Class.forName("java.lang.annotation.Repeatable");
|
||||||
return c;
|
return c;
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -276,12 +276,12 @@ public class JavacElements implements Elements {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static Method initValueElementMethod() {
|
private static Method initValueElementMethod() {
|
||||||
if (CONTAINED_BY_CLASS == null)
|
if (REPEATABLE_CLASS == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Method m = null;
|
Method m = null;
|
||||||
try {
|
try {
|
||||||
m = CONTAINED_BY_CLASS.getMethod("value");
|
m = REPEATABLE_CLASS.getMethod("value");
|
||||||
if (m != null)
|
if (m != null)
|
||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
return m;
|
return m;
|
||||||
|
@ -292,19 +292,19 @@ public class JavacElements implements Elements {
|
||||||
|
|
||||||
// Helper to getAnnotations
|
// Helper to getAnnotations
|
||||||
private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
|
private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
|
||||||
// Since we can not refer to java.lang.annotation.ContainedBy until we are
|
// Since we can not refer to java.lang.annotation.Repeatable until we are
|
||||||
// bootstrapping with java 8 we need to get the ContainedBy annotation using
|
// bootstrapping with java 8 we need to get the Repeatable annotation using
|
||||||
// reflective invocations instead of just using its type and element method.
|
// reflective invocations instead of just using its type and element method.
|
||||||
if (CONTAINED_BY_CLASS != null &&
|
if (REPEATABLE_CLASS != null &&
|
||||||
VALUE_ELEMENT_METHOD != null) {
|
VALUE_ELEMENT_METHOD != null) {
|
||||||
// Get the ContainedBy instance on the annotations declaration
|
// Get the Repeatable instance on the annotations declaration
|
||||||
Annotation containedBy = (Annotation)annoType.getAnnotation(CONTAINED_BY_CLASS);
|
Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS);
|
||||||
if (containedBy != null) {
|
if (repeatable != null) {
|
||||||
try {
|
try {
|
||||||
// Get the value element, it should be a class
|
// Get the value element, it should be a class
|
||||||
// indicating the containing annotation type
|
// indicating the containing annotation type
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(containedBy);
|
Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable);
|
||||||
if (containerType == null)
|
if (containerType == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
|
@ -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.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -319,64 +319,48 @@ compiler.err.duplicate.annotation.member.value=\
|
||||||
compiler.err.duplicate.annotation.missing.container=\
|
compiler.err.duplicate.annotation.missing.container=\
|
||||||
duplicate annotation, the declaration of {0} does not have a valid {1} annotation
|
duplicate annotation, the declaration of {0} does not have a valid {1} annotation
|
||||||
|
|
||||||
# 0: type, 1: type
|
# 0: type
|
||||||
compiler.err.invalid.container.no.containedby=\
|
compiler.err.invalid.repeatable.annotation=\
|
||||||
invalid contained repeatable annotation, {0} is not annotated with {1}
|
duplicate annotation, {0} is annotated with an invalid Repeatable annotation
|
||||||
|
|
||||||
# 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
|
# 0: type
|
||||||
compiler.err.invalid.containedby.annotation=\
|
compiler.err.invalid.repeatable.annotation.no.value=\
|
||||||
duplicate annotation, {0} is annotated with an invalid ContainedBy annotation
|
duplicate annotation, {0} is not a valid Repeatable, no value element method declared
|
||||||
|
|
||||||
# 0: type
|
|
||||||
compiler.err.invalid.containedby.annotation.no.value=\
|
|
||||||
duplicate annotation, {0} is not a valid ContainedBy, no value element method declared
|
|
||||||
|
|
||||||
# 0: type, 1: number
|
# 0: type, 1: number
|
||||||
compiler.err.invalid.containedby.annotation.multiple.values=\
|
compiler.err.invalid.repeatable.annotation.multiple.values=\
|
||||||
duplicate annotation, {0} is not a valid ContainedBy, {1} value element methods declared
|
duplicate annotation, {0} is not a valid Repeatable, {1} value element methods declared
|
||||||
|
|
||||||
# 0: type
|
# 0: type
|
||||||
compiler.err.invalid.containedby.annotation.invalid.value=\
|
compiler.err.invalid.repeatable.annotation.invalid.value=\
|
||||||
duplicate annotation, {0} is not a valid ContainedBy, invalid value element, need a method
|
duplicate annotation, {0} is not a valid Repeatable, invalid value element, need a method
|
||||||
|
|
||||||
# 0: type, 1: type, 2: type
|
# 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}
|
duplicate annotation, value element of containing annotation {0} should have type {2}, found {1}
|
||||||
|
|
||||||
# 0: type, 1: symbol
|
# 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}
|
containing annotation {0} does not have a default value for element {1}
|
||||||
|
|
||||||
# 0: symbol, 1: type, 2: symbol, 3: type
|
# 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}
|
containing annotation {0} has shorter retention ({1}) than the contained annotation {2} with retention {3}
|
||||||
|
|
||||||
# 0: symbol, 1: symbol
|
# 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
|
containing annotation type, {0}, is not @Documented while repeated annotation type, {1}, is
|
||||||
|
|
||||||
# 0: symbol, 1: symbol
|
# 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
|
containing annotation type, {0}, is not @Inherited while repeated annotation type, {1}, is
|
||||||
|
|
||||||
# 0: symbol, 1: symbol
|
# 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}
|
target of container annotation {0} is not a subset of target of repeated annotation {1}
|
||||||
|
|
||||||
# 0: symbol
|
# 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
|
container {0} must not be present at the same time as the element it contains
|
||||||
|
|
||||||
# 0: name
|
# 0: name
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,6 +32,6 @@ import java.lang.annotation.*;
|
||||||
* @author Bhavesh Patel
|
* @author Bhavesh Patel
|
||||||
*/
|
*/
|
||||||
@Documented
|
@Documented
|
||||||
@ContainedBy(ContainerSynthDoc.class)
|
@Repeatable(ContainerSynthDoc.class)
|
||||||
public @interface ContaineeSynthDoc {
|
public @interface ContaineeSynthDoc {
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,7 +32,6 @@ import java.lang.annotation.*;
|
||||||
* @author Bhavesh Patel
|
* @author Bhavesh Patel
|
||||||
*/
|
*/
|
||||||
@Documented
|
@Documented
|
||||||
@ContainerFor(ContaineeSynthDoc.class)
|
|
||||||
public @interface ContainerSynthDoc {
|
public @interface ContainerSynthDoc {
|
||||||
|
|
||||||
ContaineeSynthDoc[] value();
|
ContaineeSynthDoc[] value();
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,6 +32,6 @@ import java.lang.annotation.*;
|
||||||
* @author Bhavesh Patel
|
* @author Bhavesh Patel
|
||||||
*/
|
*/
|
||||||
@Documented
|
@Documented
|
||||||
@ContainedBy(ContainerSynthNotDoc.class)
|
@Repeatable(ContainerSynthNotDoc.class)
|
||||||
public @interface ContaineeSynthDoc {
|
public @interface ContaineeSynthDoc {
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -31,7 +31,6 @@ import java.lang.annotation.*;
|
||||||
*
|
*
|
||||||
* @author Bhavesh Patel
|
* @author Bhavesh Patel
|
||||||
*/
|
*/
|
||||||
@ContainerFor(ContaineeSynthDoc.class)
|
|
||||||
public @interface ContainerSynthNotDoc {
|
public @interface ContainerSynthNotDoc {
|
||||||
|
|
||||||
ContaineeSynthDoc[] value();
|
ContaineeSynthDoc[] value();
|
||||||
|
|
|
@ -6,11 +6,9 @@
|
||||||
* @compile/fail/ref=BaseAnnoAsContainerAnno.out -XDrawDiagnostics BaseAnnoAsContainerAnno.java
|
* @compile/fail/ref=BaseAnnoAsContainerAnno.out -XDrawDiagnostics BaseAnnoAsContainerAnno.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy(Foo.class)
|
@Repeatable(Foo.class)
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface Foo {
|
@interface Foo {
|
||||||
Foo[] value() default {};
|
Foo[] value() default {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
BaseAnnoAsContainerAnno.java:15:11: compiler.err.cyclic.annotation.element
|
BaseAnnoAsContainerAnno.java:13:11: compiler.err.cyclic.annotation.element
|
||||||
1 error
|
1 error
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -34,10 +34,9 @@
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@ContainedBy(Foos.class)
|
@Repeatable(Foos.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@interface Foos {
|
@interface Foos {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,32 +32,29 @@
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Foos.class)
|
@Repeatable(Foos.class)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@Target(ElementType.ANNOTATION_TYPE)
|
@Target(ElementType.ANNOTATION_TYPE)
|
||||||
@interface Foos {
|
@interface Foos {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainedBy(Bars.class)
|
@Repeatable(Bars.class)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
@interface Bar {}
|
@interface Bar {}
|
||||||
|
|
||||||
@ContainerFor(Bar.class)
|
|
||||||
@Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE })
|
@Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE })
|
||||||
@interface Bars {
|
@interface Bars {
|
||||||
Bar[] value();
|
Bar[] value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ContainedBy(Bazs.class)
|
@Repeatable(Bazs.class)
|
||||||
@Target({ ElementType.TYPE, ElementType.ANNOTATION_TYPE })
|
@Target({ ElementType.TYPE, ElementType.ANNOTATION_TYPE })
|
||||||
@interface Baz {}
|
@interface Baz {}
|
||||||
|
|
||||||
@ContainerFor(Baz.class)
|
|
||||||
@Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE })
|
@Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE })
|
||||||
@interface Bazs {
|
@interface Bazs {
|
||||||
Baz[] value();
|
Baz[] value();
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -30,17 +30,15 @@
|
||||||
* @compile ClassReaderDefault.java
|
* @compile ClassReaderDefault.java
|
||||||
* @compile SeparateCompile.java
|
* @compile SeparateCompile.java
|
||||||
*/
|
*/
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
public class ClassReaderDefault {
|
public class ClassReaderDefault {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer {
|
@interface FooContainer {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
int f() default 0;
|
int f() default 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainedBy(FooContainer.class)
|
@Repeatable(FooContainer.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -30,15 +30,13 @@
|
||||||
* @run compile ContainerHasRepeatedContained.java
|
* @run compile ContainerHasRepeatedContained.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy(BarContainer.class)
|
@Repeatable(BarContainer.class)
|
||||||
@interface Bar {}
|
@interface Bar {}
|
||||||
|
|
||||||
@Bar
|
@Bar
|
||||||
@Bar
|
@Bar
|
||||||
@ContainerFor(Bar.class)
|
|
||||||
@interface BarContainer {
|
@interface BarContainer {
|
||||||
Bar[] value();
|
Bar[] value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,14 @@
|
||||||
* @compile/fail/ref=CyclicAnnotation.out -XDrawDiagnostics CyclicAnnotation.java
|
* @compile/fail/ref=CyclicAnnotation.out -XDrawDiagnostics CyclicAnnotation.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy(Foo.class)
|
@Repeatable(Foo.class)
|
||||||
@ContainerFor(Baz.class)
|
|
||||||
@interface Baz {
|
@interface Baz {
|
||||||
Foo[] value() default {};
|
Foo[] value() default {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainedBy(Baz.class)
|
@Repeatable(Baz.class)
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface Foo{
|
@interface Foo{
|
||||||
Baz[] value() default {};
|
Baz[] value() default {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,2 @@
|
||||||
CyclicAnnotation.java:12:1: compiler.err.invalid.container.wrong.containerfor: Foo, Baz
|
CyclicAnnotation.java:13:11: compiler.err.cyclic.annotation.element
|
||||||
CyclicAnnotation.java:13:1: compiler.err.invalid.container.wrong.containedby: Foo, Baz
|
1 error
|
||||||
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
|
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -29,13 +29,11 @@
|
||||||
* @compile DefaultCasePresent.java
|
* @compile DefaultCasePresent.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy(FooContainer.class)
|
@Repeatable(FooContainer.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer {
|
@interface FooContainer {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
String other() default "other-method";
|
String other() default "other-method";
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -39,12 +39,11 @@ public class DelayRepeatedContainer {
|
||||||
|
|
||||||
@Bar("katt")
|
@Bar("katt")
|
||||||
@Bar("lol")
|
@Bar("lol")
|
||||||
@ContainedBy(BarContainer.class)
|
@Repeatable(BarContainer.class)
|
||||||
@interface Bar {
|
@interface Bar {
|
||||||
String value();
|
String value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainerFor(Bar.class)
|
|
||||||
@interface BarContainer {
|
@interface BarContainer {
|
||||||
Bar[] value();
|
Bar[] value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,13 @@
|
||||||
* @compile/fail/ref=DocumentedContainerAnno.out -XDrawDiagnostics DocumentedContainerAnno.java
|
* @compile/fail/ref=DocumentedContainerAnno.out -XDrawDiagnostics DocumentedContainerAnno.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
import java.lang.annotation.Documented;
|
import java.lang.annotation.Documented;
|
||||||
|
|
||||||
@Documented
|
@Documented
|
||||||
@ContainedBy(FooContainer.class)
|
@Repeatable(FooContainer.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer{
|
@interface FooContainer{
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
1 error
|
||||||
|
|
|
@ -6,15 +6,13 @@
|
||||||
* @compile/fail/ref=InheritedContainerAnno.out -XDrawDiagnostics InheritedContainerAnno.java
|
* @compile/fail/ref=InheritedContainerAnno.out -XDrawDiagnostics InheritedContainerAnno.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
import java.lang.annotation.Inherited;
|
import java.lang.annotation.Inherited;
|
||||||
|
|
||||||
@Inherited
|
@Inherited
|
||||||
@ContainedBy(FooContainer.class)
|
@Repeatable(FooContainer.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer{
|
@interface FooContainer{
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
1 error
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,11 +32,10 @@
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Foos.class)
|
@Repeatable(Foos.class)
|
||||||
@Target(ElementType.ANNOTATION_TYPE)
|
@Target(ElementType.ANNOTATION_TYPE)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
@interface Foos {
|
@interface Foos {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
|
|
|
@ -6,13 +6,11 @@
|
||||||
* @compile/fail/ref=MissingContainer.out -XDrawDiagnostics MissingContainer.java
|
* @compile/fail/ref=MissingContainer.out -XDrawDiagnostics MissingContainer.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy()
|
@Repeatable()
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer {
|
@interface FooContainer {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
MissingContainer.java:20:1: compiler.err.invalid.containedby.annotation: Foo
|
MissingContainer.java:18:1: compiler.err.invalid.repeatable.annotation: Foo
|
||||||
MissingContainer.java:20:6: compiler.err.invalid.containedby.annotation: Foo
|
MissingContainer.java:18:6: compiler.err.invalid.repeatable.annotation: Foo
|
||||||
MissingContainer.java:12:1: compiler.err.annotation.missing.default.value: java.lang.annotation.ContainedBy, value
|
MissingContainer.java:11:1: compiler.err.annotation.missing.default.value: java.lang.annotation.Repeatable, value
|
||||||
MissingContainer.java:15:1: compiler.err.invalid.container.wrong.containedby: Foo, FooContainer
|
3 errors
|
||||||
4 errors
|
|
||||||
|
|
|
@ -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 {}
|
|
|
@ -6,13 +6,11 @@
|
||||||
* @compile/fail/ref=MissingDefaultCase1.out -XDrawDiagnostics MissingDefaultCase1.java
|
* @compile/fail/ref=MissingDefaultCase1.out -XDrawDiagnostics MissingDefaultCase1.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy(FooContainer.class)
|
@Repeatable(FooContainer.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer {
|
@interface FooContainer {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
String other(); // missing default clause
|
String other(); // missing default clause
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
MissingDefaultCase1.java:21:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
|
MissingDefaultCase1.java:19:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
|
||||||
MissingDefaultCase1.java:12:1: compiler.err.invalid.containedby.annotation.elem.nondefault: FooContainer, other()
|
MissingDefaultCase1.java:11:1: compiler.err.invalid.repeatable.annotation.elem.nondefault: FooContainer, other()
|
||||||
2 errors
|
2 errors
|
||||||
|
|
|
@ -6,13 +6,11 @@
|
||||||
* @compile/fail/ref=MissingDefaultCase2.out -XDrawDiagnostics MissingDefaultCase2.java
|
* @compile/fail/ref=MissingDefaultCase2.out -XDrawDiagnostics MissingDefaultCase2.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy(FooContainer.class)
|
@Repeatable(FooContainer.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer {
|
@interface FooContainer {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
Foo other(); // missing default clause and return type is an annotation
|
Foo other(); // missing default clause and return type is an annotation
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
MissingDefaultCase2.java:21:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
|
MissingDefaultCase2.java:19:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
|
||||||
MissingDefaultCase2.java:12:1: compiler.err.invalid.containedby.annotation.elem.nondefault: FooContainer, other()
|
MissingDefaultCase2.java:11:1: compiler.err.invalid.repeatable.annotation.elem.nondefault: FooContainer, other()
|
||||||
2 errors
|
2 errors
|
||||||
|
|
|
@ -6,13 +6,11 @@
|
||||||
* @compile/fail/ref=MissingValueMethod.out -XDrawDiagnostics MissingValueMethod.java
|
* @compile/fail/ref=MissingValueMethod.out -XDrawDiagnostics MissingValueMethod.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy(FooContainer.class)
|
@Repeatable(FooContainer.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer{
|
@interface FooContainer{
|
||||||
Foo[] values(); // wrong method name
|
Foo[] values(); // wrong method name
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
MissingValueMethod.java:20:1: compiler.err.invalid.containedby.annotation.no.value: FooContainer
|
MissingValueMethod.java:18:1: compiler.err.invalid.repeatable.annotation.no.value: FooContainer
|
||||||
MissingValueMethod.java:20:6: compiler.err.invalid.containedby.annotation.no.value: FooContainer
|
MissingValueMethod.java:18:6: compiler.err.invalid.repeatable.annotation.no.value: FooContainer
|
||||||
MissingValueMethod.java:12:1: compiler.err.invalid.containedby.annotation.elem.nondefault: FooContainer, values()
|
MissingValueMethod.java:11:1: compiler.err.invalid.repeatable.annotation.no.value: FooContainer
|
||||||
3 errors
|
3 errors
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -29,19 +29,16 @@
|
||||||
* @compile MultiLevelRepeatableAnno.java
|
* @compile MultiLevelRepeatableAnno.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy(FooContainer.class)
|
@Repeatable(FooContainer.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainedBy(FooContainerContainer.class)
|
@Repeatable(FooContainerContainer.class)
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer {
|
@interface FooContainer {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainerFor(FooContainer.class)
|
|
||||||
@interface FooContainerContainer {
|
@interface FooContainerContainer {
|
||||||
FooContainer[] value();
|
FooContainer[] value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -29,25 +29,22 @@
|
||||||
* @compile MultipleAnnoMixedOrder.java
|
* @compile MultipleAnnoMixedOrder.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy(FooContainer.class)
|
@Repeatable(FooContainer.class)
|
||||||
@interface Foo {
|
@interface Foo {
|
||||||
int getNumbers();
|
int getNumbers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer {
|
@interface FooContainer {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainedBy(BazContainer.class)
|
@Repeatable(BazContainer.class)
|
||||||
@interface Baz {
|
@interface Baz {
|
||||||
String getStr();
|
String getStr();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainerFor(Baz.class)
|
|
||||||
@interface BazContainer {
|
@interface BazContainer {
|
||||||
Baz[] value();
|
Baz[] value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -34,17 +34,15 @@
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@ContainedBy(Foos.class)
|
@Repeatable(Foos.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@ContainedBy(FoosFoos.class)
|
@Repeatable(FoosFoos.class)
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface Foos {
|
@interface Foos {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainerFor(Foos.class)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@interface FoosFoos {
|
@interface FoosFoos {
|
||||||
Foos[] value();
|
Foos[] value();
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
NoRepeatableAnno.java:11:1: 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.ContainedBy
|
NoRepeatableAnno.java:11:6: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.Repeatable
|
||||||
2 errors
|
2 errors
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -30,20 +30,18 @@
|
||||||
* @run compile RepMemberAnno.java
|
* @run compile RepMemberAnno.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
public class RepMemberAnno {
|
public class RepMemberAnno {
|
||||||
@Bar("Apa") @Bar("Banan")
|
@Bar("Apa") @Bar("Banan")
|
||||||
public void meh() {}
|
public void meh() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainedBy(BarContainer.class)
|
@Repeatable(BarContainer.class)
|
||||||
@interface Bar {
|
@interface Bar {
|
||||||
String value();
|
String value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainerFor(Bar.class)
|
|
||||||
@interface BarContainer {
|
@interface BarContainer {
|
||||||
Bar[] value();
|
Bar[] value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -34,21 +34,19 @@ import java.lang.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@ContainedBy(BarContainer.class)
|
@Repeatable(BarContainer.class)
|
||||||
public @interface RepSelfMemberAnno {
|
public @interface RepSelfMemberAnno {
|
||||||
@RepSelfMemberAnno @RepSelfMemberAnno
|
@RepSelfMemberAnno @RepSelfMemberAnno
|
||||||
String meh() default "banan";
|
String meh() default "banan";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ContainedBy(BarContainerContainer.class)
|
@Repeatable(BarContainerContainer.class)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@ContainerFor(RepSelfMemberAnno.class)
|
|
||||||
@interface BarContainer {
|
@interface BarContainer {
|
||||||
RepSelfMemberAnno[] value();
|
RepSelfMemberAnno[] value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainerFor(BarContainer.class)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@interface BarContainerContainer {
|
@interface BarContainerContainer {
|
||||||
BarContainer[] value();
|
BarContainer[] value();
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Foos.class)
|
@Repeatable(Foos.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@interface Foos {
|
@interface Foos {
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -31,10 +31,9 @@
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Foos.class)
|
@Repeatable(Foos.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@Target(ElementType.ANNOTATION_TYPE)
|
@Target(ElementType.ANNOTATION_TYPE)
|
||||||
@interface Foos {
|
@interface Foos {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
|
|
|
@ -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
|
1 error
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainerFor(SelfRepeatingAnno.class)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@interface Foos {
|
@interface Foos {
|
||||||
SelfRepeatingAnno[] value();
|
SelfRepeatingAnno[] value();
|
||||||
|
@ -42,7 +41,7 @@ import java.lang.annotation.*;
|
||||||
@SelfRepeatingAnno
|
@SelfRepeatingAnno
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@SelfRepeatingAnno
|
@SelfRepeatingAnno
|
||||||
@ContainedBy(Foos.class)
|
@Repeatable(Foos.class)
|
||||||
@interface SelfRepeatingAnno {}
|
@interface SelfRepeatingAnno {}
|
||||||
|
|
||||||
public class SelfRepeatingAnnotations {
|
public class SelfRepeatingAnnotations {
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -30,10 +30,9 @@
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Foos.class)
|
@Repeatable(Foos.class)
|
||||||
@interface Foo {}
|
@interface Foo {}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface Foos {
|
@interface Foos {
|
||||||
Foo[] value();
|
Foo[] value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {}
|
|
|
@ -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 {}
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -24,16 +24,18 @@
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @summary Smoke test for repeating annotations
|
* @summary Smoke test for repeating annotations
|
||||||
* @compile/fail MissingContainedBy.java
|
* @compile/fail UseWrongRepeatable.java
|
||||||
* @bug 7151010
|
* @bug 7151010
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
@ContainerFor(MissingContainedBy.class)
|
|
||||||
@interface Foos {
|
@interface Foos {
|
||||||
MissingContainedBy[] value();
|
UseWrongRepeatable[] value();
|
||||||
}
|
}
|
||||||
|
|
||||||
public @interface MissingContainedBy {}
|
@Repeatable(Target.class)
|
||||||
|
public @interface UseWrongRepeatable {}
|
||||||
|
|
||||||
|
@UseWrongRepeatable @UseWrongRepeatable
|
||||||
|
@interface Foo {}
|
|
@ -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 {}
|
|
|
@ -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 {}
|
|
|
@ -6,15 +6,13 @@
|
||||||
* @compile/fail/ref=WrongReturnTypeForValue.out -XDrawDiagnostics WrongReturnTypeForValue.java
|
* @compile/fail/ref=WrongReturnTypeForValue.out -XDrawDiagnostics WrongReturnTypeForValue.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.annotation.ContainedBy;
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.annotation.ContainerFor;
|
|
||||||
|
|
||||||
@ContainedBy(FooContainer.class)
|
@Repeatable(FooContainer.class)
|
||||||
@interface Foo {
|
@interface Foo {
|
||||||
int getNumbers();
|
int getNumbers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ContainerFor(Foo.class)
|
|
||||||
@interface FooContainer{
|
@interface FooContainer{
|
||||||
Foo value(); // wrong return type
|
Foo value(); // wrong return type
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
WrongReturnTypeForValue.java:22:1: compiler.err.invalid.containedby.annotation.value.return: FooContainer, Foo, Foo[]
|
WrongReturnTypeForValue.java:20:1: compiler.err.invalid.repeatable.annotation.value.return: FooContainer, Foo, Foo[]
|
||||||
WrongReturnTypeForValue.java:22:6: compiler.err.invalid.containedby.annotation.value.return: FooContainer, Foo, Foo[]
|
WrongReturnTypeForValue.java:20:6: compiler.err.invalid.repeatable.annotation.value.return: FooContainer, Foo, Foo[]
|
||||||
2 errors
|
WrongReturnTypeForValue.java:11:1: compiler.err.invalid.repeatable.annotation.value.return: FooContainer, Foo, Foo[]
|
||||||
|
3 errors
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -163,9 +163,8 @@ public class BasicSyntaxCombo extends Helper{
|
||||||
String replaceStr = "/*"+type+"*/";
|
String replaceStr = "/*"+type+"*/";
|
||||||
StringBuilder annoData = new StringBuilder();
|
StringBuilder annoData = new StringBuilder();
|
||||||
annoData.append(Helper.ContentVars.IMPORTCONTAINERSTMTS.getVal())
|
annoData.append(Helper.ContentVars.IMPORTCONTAINERSTMTS.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINERFOR.getVal())
|
|
||||||
.append(Helper.ContentVars.CONTAINER.getVal())
|
.append(Helper.ContentVars.CONTAINER.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINEDBY.getVal())
|
.append(Helper.ContentVars.REPEATABLE.getVal())
|
||||||
.append(Helper.ContentVars.BASE.getVal());
|
.append(Helper.ContentVars.BASE.getVal());
|
||||||
|
|
||||||
JavaFileObject pkgInfoFile = null;
|
JavaFileObject pkgInfoFile = null;
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -115,24 +115,21 @@ public class DeprecatedAnnoCombo extends Helper {
|
||||||
switch(className) {
|
switch(className) {
|
||||||
case "DeprecatedonBoth":
|
case "DeprecatedonBoth":
|
||||||
annoData.append(Helper.ContentVars.DEPRECATED.getVal())
|
annoData.append(Helper.ContentVars.DEPRECATED.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINERFOR.getVal())
|
|
||||||
.append(Helper.ContentVars.CONTAINER.getVal())
|
.append(Helper.ContentVars.CONTAINER.getVal())
|
||||||
.append(Helper.ContentVars.DEPRECATED.getVal())
|
.append(Helper.ContentVars.DEPRECATED.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINEDBY.getVal())
|
.append(Helper.ContentVars.REPEATABLE.getVal())
|
||||||
.append(Helper.ContentVars.BASE.getVal());
|
.append(Helper.ContentVars.BASE.getVal());
|
||||||
break;
|
break;
|
||||||
case "DeprecatedonBase":
|
case "DeprecatedonBase":
|
||||||
annoData.append(Helper.ContentVars.CONTAINERFOR.getVal())
|
annoData.append(Helper.ContentVars.CONTAINER.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINER.getVal())
|
|
||||||
.append(Helper.ContentVars.DEPRECATED.getVal())
|
.append(Helper.ContentVars.DEPRECATED.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINEDBY.getVal())
|
.append(Helper.ContentVars.REPEATABLE.getVal())
|
||||||
.append(Helper.ContentVars.BASE.getVal());
|
.append(Helper.ContentVars.BASE.getVal());
|
||||||
break;
|
break;
|
||||||
case "DeprecatedonContainer":
|
case "DeprecatedonContainer":
|
||||||
annoData.append(Helper.ContentVars.DEPRECATED.getVal())
|
annoData.append(Helper.ContentVars.DEPRECATED.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINERFOR.getVal())
|
|
||||||
.append(Helper.ContentVars.CONTAINER.getVal())
|
.append(Helper.ContentVars.CONTAINER.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINEDBY.getVal())
|
.append(Helper.ContentVars.REPEATABLE.getVal())
|
||||||
.append(Helper.ContentVars.BASE.getVal());
|
.append(Helper.ContentVars.BASE.getVal());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -93,17 +93,15 @@ public class DocumentedAnnoCombo extends Helper {
|
||||||
switch(className) {
|
switch(className) {
|
||||||
case "DocumentedonBothAnno":
|
case "DocumentedonBothAnno":
|
||||||
annoData.append(Helper.ContentVars.DOCUMENTED.getVal())
|
annoData.append(Helper.ContentVars.DOCUMENTED.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINERFOR.getVal())
|
|
||||||
.append(Helper.ContentVars.CONTAINER.getVal())
|
.append(Helper.ContentVars.CONTAINER.getVal())
|
||||||
.append(Helper.ContentVars.DOCUMENTED.getVal())
|
.append(Helper.ContentVars.DOCUMENTED.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINEDBY.getVal())
|
.append(Helper.ContentVars.REPEATABLE.getVal())
|
||||||
.append(Helper.ContentVars.BASE.getVal());
|
.append(Helper.ContentVars.BASE.getVal());
|
||||||
break;
|
break;
|
||||||
case "DocumentedonContainer":
|
case "DocumentedonContainer":
|
||||||
annoData.append(Helper.ContentVars.DOCUMENTED.getVal())
|
annoData.append(Helper.ContentVars.DOCUMENTED.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINERFOR.getVal())
|
|
||||||
.append(Helper.ContentVars.CONTAINER.getVal())
|
.append(Helper.ContentVars.CONTAINER.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINEDBY.getVal())
|
.append(Helper.ContentVars.REPEATABLE.getVal())
|
||||||
.append(Helper.ContentVars.BASE.getVal());
|
.append(Helper.ContentVars.BASE.getVal());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -34,15 +34,13 @@ import javax.tools.JavaCompiler.CompilationTask;
|
||||||
public class Helper {
|
public class Helper {
|
||||||
|
|
||||||
enum ContentVars {
|
enum ContentVars {
|
||||||
IMPORTCONTAINERSTMTS("\nimport java.lang.annotation.ContainedBy;\n" +
|
IMPORTCONTAINERSTMTS("\nimport java.lang.annotation.Repeatable;\n"),
|
||||||
"\nimport java.lang.annotation.ContainerFor;\n"),
|
|
||||||
IMPORTDEPRECATED("import java.lang.Deprecated;\n"),
|
IMPORTDEPRECATED("import java.lang.Deprecated;\n"),
|
||||||
IMPORTDOCUMENTED("import java.lang.annotation.Documented;\n"),
|
IMPORTDOCUMENTED("import java.lang.annotation.Documented;\n"),
|
||||||
IMPORTINHERITED("import java.lang.annotation.Inherited;\n"),
|
IMPORTINHERITED("import java.lang.annotation.Inherited;\n"),
|
||||||
IMPORTRETENTION("import java.lang.annotation.Retention;\n" +
|
IMPORTRETENTION("import java.lang.annotation.Retention;\n" +
|
||||||
"\nimport java.lang.annotation.RetentionPolicy;\n"),
|
"\nimport java.lang.annotation.RetentionPolicy;\n"),
|
||||||
CONTAINEDBY("\n@ContainedBy(FooContainer.class)\n"),
|
REPEATABLE("\n@Repeatable(FooContainer.class)\n"),
|
||||||
CONTAINERFOR("@ContainerFor(Foo.class)\n"),
|
|
||||||
CONTAINER("@interface FooContainer {\n" +" Foo[] value();\n}\n"),
|
CONTAINER("@interface FooContainer {\n" +" Foo[] value();\n}\n"),
|
||||||
BASE("@interface Foo {}\n"),
|
BASE("@interface Foo {}\n"),
|
||||||
REPEATABLEANNO("\n@Foo() @Foo()"),
|
REPEATABLEANNO("\n@Foo() @Foo()"),
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -94,17 +94,15 @@ public class InheritedAnnoCombo extends Helper {
|
||||||
switch(className) {
|
switch(className) {
|
||||||
case "InheritedonBothAnno":
|
case "InheritedonBothAnno":
|
||||||
annoData.append(Helper.ContentVars.INHERITED.getVal())
|
annoData.append(Helper.ContentVars.INHERITED.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINERFOR.getVal())
|
|
||||||
.append(Helper.ContentVars.CONTAINER.getVal())
|
.append(Helper.ContentVars.CONTAINER.getVal())
|
||||||
.append(Helper.ContentVars.INHERITED.getVal())
|
.append(Helper.ContentVars.INHERITED.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINEDBY.getVal())
|
.append(Helper.ContentVars.REPEATABLE.getVal())
|
||||||
.append(Helper.ContentVars.BASE.getVal());
|
.append(Helper.ContentVars.BASE.getVal());
|
||||||
break;
|
break;
|
||||||
case "InheritedonBase":
|
case "InheritedonBase":
|
||||||
annoData.append(Helper.ContentVars.INHERITED.getVal())
|
annoData.append(Helper.ContentVars.INHERITED.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINERFOR.getVal())
|
|
||||||
.append(Helper.ContentVars.CONTAINER.getVal())
|
.append(Helper.ContentVars.CONTAINER.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINEDBY.getVal())
|
.append(Helper.ContentVars.REPEATABLE.getVal())
|
||||||
.append(Helper.ContentVars.BASE.getVal());
|
.append(Helper.ContentVars.BASE.getVal());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -120,7 +120,7 @@ public class RetentionAnnoCombo extends Helper {
|
||||||
new DiagnosticCollector<JavaFileObject>();
|
new DiagnosticCollector<JavaFileObject>();
|
||||||
boolean ok = compileCode(className, contents, diagnostics);
|
boolean ok = compileCode(className, contents, diagnostics);
|
||||||
|
|
||||||
String expectedErrKey = "compiler.err.invalid.containedby" +
|
String expectedErrKey = "compiler.err.invalid.repeatable" +
|
||||||
".annotation.retention";
|
".annotation.retention";
|
||||||
if (!shouldCompile && !ok) {
|
if (!shouldCompile && !ok) {
|
||||||
for (Diagnostic<?> d : diagnostics.getDiagnostics()) {
|
for (Diagnostic<?> d : diagnostics.getDiagnostics()) {
|
||||||
|
@ -175,10 +175,9 @@ public class RetentionAnnoCombo extends Helper {
|
||||||
StringBuilder annoData = new StringBuilder();
|
StringBuilder annoData = new StringBuilder();
|
||||||
annoData.append(Helper.ContentVars.IMPORTCONTAINERSTMTS.getVal())
|
annoData.append(Helper.ContentVars.IMPORTCONTAINERSTMTS.getVal())
|
||||||
.append(Helper.ContentVars.IMPORTRETENTION.getVal())
|
.append(Helper.ContentVars.IMPORTRETENTION.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINERFOR.getVal())
|
|
||||||
.append(replacedRetCAVal)
|
.append(replacedRetCAVal)
|
||||||
.append(Helper.ContentVars.CONTAINER.getVal())
|
.append(Helper.ContentVars.CONTAINER.getVal())
|
||||||
.append(Helper.ContentVars.CONTAINEDBY.getVal())
|
.append(Helper.ContentVars.REPEATABLE.getVal())
|
||||||
.append(replacedRetBaseVal)
|
.append(replacedRetBaseVal)
|
||||||
.append(Helper.ContentVars.BASE.getVal());
|
.append(Helper.ContentVars.BASE.getVal());
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ compiler.err.cant.read.file # (apt.JavaCompiler?)
|
||||||
compiler.err.cant.select.static.class.from.param.type
|
compiler.err.cant.select.static.class.from.param.type
|
||||||
compiler.err.dc.unterminated.string # cannot happen
|
compiler.err.dc.unterminated.string # cannot happen
|
||||||
compiler.err.illegal.char.for.encoding
|
compiler.err.illegal.char.for.encoding
|
||||||
compiler.err.invalid.containedby.annotation # should not happen
|
compiler.err.invalid.repeatable.annotation # should not happen
|
||||||
compiler.err.invalid.containedby.annotation.invalid.value # "can't" happen
|
compiler.err.invalid.repeatable.annotation.invalid.value # "can't" happen
|
||||||
compiler.err.invalid.containedby.annotation.multiple.values # can't happen
|
compiler.err.invalid.repeatable.annotation.multiple.values # can't happen
|
||||||
compiler.err.io.exception # (javah.JavahTask?)
|
compiler.err.io.exception # (javah.JavahTask?)
|
||||||
compiler.err.limit.code # Code
|
compiler.err.limit.code # Code
|
||||||
compiler.err.limit.code.too.large.for.try.stmt # Gen
|
compiler.err.limit.code.too.large.for.try.stmt # Gen
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* 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.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
|
// We need an almost valid containing annotation. The easiest way to get
|
||||||
// one close enough to valid is by forgetting a default.
|
// one close enough to valid is by forgetting a default.
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Annos.class)
|
@Repeatable(Annos.class)
|
||||||
@interface Anno { }
|
@interface Anno { }
|
||||||
|
|
||||||
@ContainerFor(Anno.class)
|
|
||||||
@interface Annos { Anno[] value(); String foo(); }
|
@interface Annos { Anno[] value(); String foo(); }
|
||||||
|
|
||||||
@Anno
|
@Anno
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,17 +21,16 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// key: compiler.err.invalid.containedby.annotation.not.documented
|
// key: compiler.err.invalid.repeatable.annotation.not.documented
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@Documented
|
@Documented
|
||||||
@ContainedBy(Annos.class)
|
@Repeatable(Annos.class)
|
||||||
@interface Anno { }
|
@interface Anno { }
|
||||||
|
|
||||||
@ContainerFor(Anno.class)
|
|
||||||
@interface Annos { Anno[] value(); }
|
@interface Annos { Anno[] value(); }
|
||||||
|
|
||||||
@Anno
|
@Anno
|
||||||
@Anno
|
@Anno
|
||||||
class ContainedByDocumentedMismatch { }
|
class RepeatableDocumentedMismatch { }
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,17 +21,16 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// key: compiler.err.invalid.containedby.annotation.not.inherited
|
// key: compiler.err.invalid.repeatable.annotation.not.inherited
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@Inherited
|
@Inherited
|
||||||
@ContainedBy(Annos.class)
|
@Repeatable(Annos.class)
|
||||||
@interface Anno { }
|
@interface Anno { }
|
||||||
|
|
||||||
@ContainerFor(Anno.class)
|
|
||||||
@interface Annos { Anno[] value(); }
|
@interface Annos { Anno[] value(); }
|
||||||
|
|
||||||
@Anno
|
@Anno
|
||||||
@Anno
|
@Anno
|
||||||
class ContainedByInheritedMismatch { }
|
class RepeatableInheritedMismatch { }
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,16 +21,15 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// key: compiler.err.invalid.containedby.annotation.no.value
|
// key: compiler.err.invalid.repeatable.annotation.no.value
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Annos.class)
|
@Repeatable(Annos.class)
|
||||||
@interface Anno { }
|
@interface Anno { }
|
||||||
|
|
||||||
@ContainerFor(Anno.class)
|
|
||||||
@interface Annos {}
|
@interface Annos {}
|
||||||
|
|
||||||
@Anno
|
@Anno
|
||||||
@Anno
|
@Anno
|
||||||
class ContainedByNoValue { }
|
class RepeatableNoValue { }
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,14 +21,13 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// key: compiler.err.invalid.containedby.annotation.elem.nondefault
|
// key: compiler.err.invalid.repeatable.annotation.elem.nondefault
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Annos.class)
|
@Repeatable(Annos.class)
|
||||||
@interface Anno { }
|
@interface Anno { }
|
||||||
|
|
||||||
@ContainerFor(Anno.class)
|
|
||||||
@interface Annos { Anno[] value(); String foo(); }
|
@interface Annos { Anno[] value(); String foo(); }
|
||||||
|
|
||||||
class ContainedByNonDefault { }
|
class RepeatableNonDefault { }
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,17 +21,16 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// key: compiler.err.invalid.containedby.annotation.retention
|
// key: compiler.err.invalid.repeatable.annotation.retention
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@ContainedBy(Annos.class)
|
@Repeatable(Annos.class)
|
||||||
@interface Anno { }
|
@interface Anno { }
|
||||||
|
|
||||||
@ContainerFor(Anno.class)
|
|
||||||
@interface Annos { Anno[] value(); }
|
@interface Annos { Anno[] value(); }
|
||||||
|
|
||||||
@Anno
|
@Anno
|
||||||
@Anno
|
@Anno
|
||||||
class ContainedByRetentionMismatch { }
|
class RepeatableRetentionMismatch { }
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,15 +21,14 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// key: compiler.err.invalid.containedby.annotation.incompatible.target
|
// key: compiler.err.invalid.repeatable.annotation.incompatible.target
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Annos.class)
|
@Repeatable(Annos.class)
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
@interface Anno { }
|
@interface Anno { }
|
||||||
|
|
||||||
@ContainerFor(Anno.class)
|
|
||||||
@interface Annos { Anno[] value(); }
|
@interface Annos { Anno[] value(); }
|
||||||
|
|
||||||
class ContainedByTargetMismatch { }
|
class RepeatableTargetMismatch { }
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,16 +21,15 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// key: compiler.err.invalid.containedby.annotation.value.return
|
// key: compiler.err.invalid.repeatable.annotation.value.return
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Annos.class)
|
@Repeatable(Annos.class)
|
||||||
@interface Anno { }
|
@interface Anno { }
|
||||||
|
|
||||||
@ContainerFor(Anno.class)
|
|
||||||
@interface Annos { String value(); }
|
@interface Annos { String value(); }
|
||||||
|
|
||||||
@Anno
|
@Anno
|
||||||
@Anno
|
@Anno
|
||||||
class ContainedByWrongValueType { }
|
class RepeatableWrongValueType { }
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,14 +21,13 @@
|
||||||
* questions.
|
* 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.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@ContainedBy(Annos.class)
|
@Repeatable(Annos.class)
|
||||||
@interface Anno { }
|
@interface Anno { }
|
||||||
|
|
||||||
@ContainerFor(Anno.class)
|
|
||||||
@interface Annos { Anno[] value(); }
|
@interface Annos { Anno[] value(); }
|
||||||
|
|
||||||
@Anno
|
@Anno
|
||||||
|
|
|
@ -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 {}
|
|
|
@ -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 {}
|
|
Loading…
Add table
Add a link
Reference in a new issue