JDK-7151008 : Add library support for repeating annotations in java.lang.annotation
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-03-05
  • Updated: 2017-05-17
  • Resolved: 2012-05-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b30Fixed
Related Reports
Cloners :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
A feature in the works for JDK 8 is repeating annotations:

JEP 120: Repeating Annotations
http://openjdk.java.net/jeps/120

As outlined in the JEP, part of implementing this feature includes adding a new meta-annotation in java.lang.annotation to record the container annotation.

Comments
SUGGESTED FIX # HG changeset patch # User darcy # Date 1331222692 28800 # Node ID 99b91217370dbdb4edc47f06a88f829444f0999d # Parent 901558acdc3a8eb50195be4d2950c79e5cd5a3d0 7151008: Add library support for repeating annotations in java.lang.annotation Reviewed-by: mcimadamore, jjg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/java/lang/annotation/ContainerAnnotation.java Thu Mar 08 08:04:52 2012 -0800 @@ -0,0 +1,46 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang.annotation; + +/** + * A meta-annotation to indicate which annotation type should be used + * as a container for repeated values of the annotation type modified + * by the {@code ContainerAnnotation} annotation. + * + * @since 1.8 + * @jls 9.6 Annotation Types + * @jls 9.7 Annotations + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.ANNOTATION_TYPE) +public @interface ContainerAnnotation { + /** + * The annotation type to use to store repeated values of another + * annotation. + */ + Class<? extends Annotation> value(); +}
09-03-2012

PUBLIC COMMENTS See http://hg.openjdk.java.net/jdk8/tl/jdk/rev/99b91217370d
09-03-2012

EVALUATION A fine idea.
05-03-2012