Skip to content

Commit

Permalink
Updated java.lang.annotation to latest OpenJDK version.
Browse files Browse the repository at this point in the history
	Change on 2016/09/14 by tball <tball@google.com>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133136124
  • Loading branch information
tomball committed Sep 16, 2016
1 parent 762436a commit adfe479
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 21 deletions.
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2009, 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
Expand Down Expand Up @@ -34,6 +34,10 @@
* More information about annotation types can be found in section 9.6 of * More information about annotation types can be found in section 9.6 of
* <cite>The Java&trade; Language Specification</cite>. * <cite>The Java&trade; Language Specification</cite>.
* *
* The {@link java.lang.reflect.AnnotatedElement} interface discusses
* compatibility concerns when evolving an annotation type from being
* non-repeatable to being repeatable.
*
* @author Josh Bloch * @author Josh Bloch
* @since 1.5 * @since 1.5
*/ */
Expand Down Expand Up @@ -126,6 +130,7 @@ public interface Annotation {


/** /**
* Returns the annotation type of this annotation. * Returns the annotation type of this annotation.
* @return the annotation type of this annotation
*/ */
Class<? extends Annotation> annotationType(); Class<? extends Annotation> annotationType();
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2008, 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
Expand Down Expand Up @@ -41,21 +41,22 @@
public class IncompleteAnnotationException extends RuntimeException { public class IncompleteAnnotationException extends RuntimeException {
private static final long serialVersionUID = 8445097402741811912L; private static final long serialVersionUID = 8445097402741811912L;


private Class annotationType; private Class<? extends Annotation> annotationType;
private String elementName; private String elementName;



/** /**
* Constructs an IncompleteAnnotationException to indicate that * Constructs an IncompleteAnnotationException to indicate that
* the named element was missing from the specified annotation type. * the named element was missing from the specified annotation type.
* *
* @param annotationType the Class object for the annotation type * @param annotationType the Class object for the annotation type
* @param elementName the name of the missing element * @param elementName the name of the missing element
* @throws NullPointerException if either parameter is {@code null}
*/ */
public IncompleteAnnotationException( public IncompleteAnnotationException(
Class<? extends Annotation> annotationType, Class<? extends Annotation> annotationType,
String elementName) { String elementName) {
super(annotationType.getName() + " missing element " + elementName); super(annotationType.getName() + " missing element " +
elementName.toString());


this.annotationType = annotationType; this.annotationType = annotationType;
this.elementName = elementName; this.elementName = elementName;
Expand Down
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2004, 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
Expand Down Expand Up @@ -44,6 +44,7 @@
* *
* @author Joshua Bloch * @author Joshua Bloch
* @since 1.5 * @since 1.5
* @jls 9.6.3.3 @Inherited
*/ */
@Documented @Documented
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
Expand Down
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2004, 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
Expand All @@ -26,43 +26,62 @@
package java.lang.annotation; package java.lang.annotation;


/** /**
* Indicates the kinds of program element to which an annotation type * Indicates the contexts in which an annotation type is applicable. The
* is applicable. If a Target meta-annotation is not present on an * declaration contexts and type contexts in which an annotation type may be
* annotation type declaration, the declared type may be used on any * applicable are specified in JLS 9.6.4.1, and denoted in source code by enum
* program element. If such a meta-annotation is present, the compiler * constants of {@link ElementType java.lang.annotation.ElementType}.
* will enforce the specified usage restriction.
* *
* For example, this meta-annotation indicates that the declared type is * <p>If an {@code @Target} meta-annotation is not present on an annotation type
* itself a meta-annotation type. It can only be used on annotation type * {@code T} , then an annotation of type {@code T} may be written as a
* declarations: * modifier for any declaration except a type parameter declaration.
*
* <p>If an {@code @Target} meta-annotation is present, the compiler will enforce
* the usage restrictions indicated by {@code ElementType}
* enum constants, in line with JLS 9.7.4.
*
* <p>For example, this {@code @Target} meta-annotation indicates that the
* declared type is itself a meta-annotation type. It can only be used on
* annotation type declarations:
* <pre> * <pre>
* &#064;Target(ElementType.ANNOTATION_TYPE) * &#064;Target(ElementType.ANNOTATION_TYPE)
* public &#064;interface MetaAnnotationType { * public &#064;interface MetaAnnotationType {
* ... * ...
* } * }
* </pre> * </pre>
* This meta-annotation indicates that the declared type is intended solely *
* for use as a member type in complex annotation type declarations. It * <p>This {@code @Target} meta-annotation indicates that the declared type is
* cannot be used to annotate anything directly: * intended solely for use as a member type in complex annotation type
* declarations. It cannot be used to annotate anything directly:
* <pre> * <pre>
* &#064;Target({}) * &#064;Target({})
* public &#064;interface MemberType { * public &#064;interface MemberType {
* ... * ...
* } * }
* </pre> * </pre>
* It is a compile-time error for a single ElementType constant to *
* appear more than once in a Target annotation. For example, the * <p>It is a compile-time error for a single {@code ElementType} constant to
* following meta-annotation is illegal: * appear more than once in an {@code @Target} annotation. For example, the
* following {@code @Target} meta-annotation is illegal:
* <pre> * <pre>
* &#064;Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD}) * &#064;Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
* public &#064;interface Bogus { * public &#064;interface Bogus {
* ... * ...
* } * }
* </pre> * </pre>
*
* @since 1.5
* @jls 9.6.4.1 @Target
* @jls 9.7.4 Where Annotations May Appear
*/ */
@Documented @Documented
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE) @Target(ElementType.ANNOTATION_TYPE)
public @interface Target { public @interface Target {
/**
* Returns an array of the kinds of elements an annotation type
* can be applied to.
* @return an array of the kinds of elements an annotation type
* can be applied to
*/
ElementType[] value(); ElementType[] value();
} }
1 change: 1 addition & 0 deletions jre_emul/java_sources.mk
Expand Up @@ -164,6 +164,7 @@ JAVA_PUBLIC_SOURCES_CORE = \
java/lang/annotation/ElementType.java \ java/lang/annotation/ElementType.java \
java/lang/annotation/IncompleteAnnotationException.java \ java/lang/annotation/IncompleteAnnotationException.java \
java/lang/annotation/Inherited.java \ java/lang/annotation/Inherited.java \
java/lang/annotation/Native.java \
java/lang/annotation/Repeatable.java \ java/lang/annotation/Repeatable.java \
java/lang/annotation/Retention.java \ java/lang/annotation/Retention.java \
java/lang/annotation/RetentionPolicy.java \ java/lang/annotation/RetentionPolicy.java \
Expand Down

0 comments on commit adfe479

Please sign in to comment.