# HG changeset patch # User Jaroslav Tulach # Date 1382359146 -7200 # Node ID fdda72fd1f4fbb6823fbb15dde468f71ecdbf5ee # Parent 9ee9b36adb53f9f0ca8661ac8faf617ab97eed2b# Parent b5f9d743a0905cebbbaf1d828a9b09244462a505 Merging annotation classes into default branch diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/Annotation.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/Annotation.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2003, 2009, 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; + +/** + * The common interface extended by all annotation types. Note that an + * interface that manually extends this one does not define + * an annotation type. Also note that this interface does not itself + * define an annotation type. + * + * More information about annotation types can be found in section 9.6 of + * The Java™ Language Specification. + * + * @author Josh Bloch + * @since 1.5 + */ +public interface Annotation { + /** + * Returns true if the specified object represents an annotation + * that is logically equivalent to this one. In other words, + * returns true if the specified object is an instance of the same + * annotation type as this instance, all of whose members are equal + * to the corresponding member of this annotation, as defined below: + * + * + * @return true if the specified object represents an annotation + * that is logically equivalent to this one, otherwise false + */ + boolean equals(Object obj); + + /** + * Returns the hash code of this annotation, as defined below: + * + *

The hash code of an annotation is the sum of the hash codes + * of its members (including those with default values), as defined + * below: + * + * The hash code of an annotation member is (127 times the hash code + * of the member-name as computed by {@link String#hashCode()}) XOR + * the hash code of the member-value, as defined below: + * + *

The hash code of a member-value depends on its type: + *

+ * + * @return the hash code of this annotation + */ + int hashCode(); + + /** + * Returns a string representation of this annotation. The details + * of the representation are implementation-dependent, but the following + * may be regarded as typical: + *
+     *   @com.acme.util.Name(first=Alfred, middle=E., last=Neuman)
+     * 
+ * + * @return a string representation of this annotation + */ + String toString(); + + /** + * Returns the annotation type of this annotation. + */ + Class annotationType(); +} diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/AnnotationFormatError.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/AnnotationFormatError.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2004, 2008, 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; + +/** + * Thrown when the annotation parser attempts to read an annotation + * from a class file and determines that the annotation is malformed. + * This error can be thrown by the {@linkplain + * java.lang.reflect.AnnotatedElement API used to read annotations + * reflectively}. + * + * @author Josh Bloch + * @see java.lang.reflect.AnnotatedElement + * @since 1.5 + */ +public class AnnotationFormatError extends Error { + private static final long serialVersionUID = -4256701562333669892L; + + /** + * Constructs a new AnnotationFormatError with the specified + * detail message. + * + * @param message the detail message. + */ + public AnnotationFormatError(String message) { + super(message); + } + + /** + * Constructs a new AnnotationFormatError with the specified + * detail message and cause. Note that the detail message associated + * with cause is not automatically incorporated in + * this error's detail message. + * + * @param message the detail message + * @param cause the cause (A null value is permitted, and + * indicates that the cause is nonexistent or unknown.) + */ + public AnnotationFormatError(String message, Throwable cause) { + super(message, cause); + } + + + /** + * Constructs a new AnnotationFormatError with the specified + * cause and a detail message of + * (cause == null ? null : cause.toString()) (which + * typically contains the class and detail message of cause). + * + * @param cause the cause (A null value is permitted, and + * indicates that the cause is nonexistent or unknown.) + */ + public AnnotationFormatError(Throwable cause) { + super(cause); + } +} diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/AnnotationTypeMismatchException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/AnnotationTypeMismatchException.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2003, 2008, 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; +import java.lang.reflect.Method; + +/** + * Thrown to indicate that a program has attempted to access an element of + * an annotation whose type has changed after the annotation was compiled + * (or serialized). + * This exception can be thrown by the {@linkplain + * java.lang.reflect.AnnotatedElement API used to read annotations + * reflectively}. + * + * @author Josh Bloch + * @see java.lang.reflect.AnnotatedElement + * @since 1.5 + */ +public class AnnotationTypeMismatchException extends RuntimeException { + private static final long serialVersionUID = 8125925355765570191L; + + /** + * The Method object for the annotation element. + */ + private final Method element; + + /** + * The (erroneous) type of data found in the annotation. This string + * may, but is not required to, contain the value as well. The exact + * format of the string is unspecified. + */ + private final String foundType; + + /** + * Constructs an AnnotationTypeMismatchException for the specified + * annotation type element and found data type. + * + * @param element the Method object for the annotation element + * @param foundType the (erroneous) type of data found in the annotation. + * This string may, but is not required to, contain the value + * as well. The exact format of the string is unspecified. + */ + public AnnotationTypeMismatchException(Method element, String foundType) { + super("Incorrectly typed data found for annotation element " + element + + " (Found data of type " + foundType + ")"); + this.element = element; + this.foundType = foundType; + } + + /** + * Returns the Method object for the incorrectly typed element. + * + * @return the Method object for the incorrectly typed element + */ + public Method element() { + return this.element; + } + + /** + * Returns the type of data found in the incorrectly typed element. + * The returned string may, but is not required to, contain the value + * as well. The exact format of the string is unspecified. + * + * @return the type of data found in the incorrectly typed element + */ + public String foundType() { + return this.foundType; + } +} diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/Documented.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/Documented.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2003, 2004, 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; + +/** + * Indicates that annotations with a type are to be documented by javadoc + * and similar tools by default. This type should be used to annotate the + * declarations of types whose annotations affect the use of annotated + * elements by their clients. If a type declaration is annotated with + * Documented, its annotations become part of the public API + * of the annotated elements. + * + * @author Joshua Bloch + * @since 1.5 + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.ANNOTATION_TYPE) +public @interface Documented { +} diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/ElementType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/ElementType.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2003, 2011, 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 program element type. The constants of this enumerated type + * provide a simple classification of the declared elements in a + * Java program. + * + *

These constants are used with the {@link Target} meta-annotation type + * to specify where it is legal to use an annotation type. + * + * @author Joshua Bloch + * @since 1.5 + */ +public enum ElementType { + /** Class, interface (including annotation type), or enum declaration */ + TYPE, + + /** Field declaration (includes enum constants) */ + FIELD, + + /** Method declaration */ + METHOD, + + /** Parameter declaration */ + PARAMETER, + + /** Constructor declaration */ + CONSTRUCTOR, + + /** Local variable declaration */ + LOCAL_VARIABLE, + + /** Annotation type declaration */ + ANNOTATION_TYPE, + + /** Package declaration */ + PACKAGE +} diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/IncompleteAnnotationException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/IncompleteAnnotationException.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2003, 2008, 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; + +/** + * Thrown to indicate that a program has attempted to access an element of + * an annotation type that was added to the annotation type definition after + * the annotation was compiled (or serialized). This exception will not be + * thrown if the new element has a default value. + * This exception can be thrown by the {@linkplain + * java.lang.reflect.AnnotatedElement API used to read annotations + * reflectively}. + * + * @author Josh Bloch + * @see java.lang.reflect.AnnotatedElement + * @since 1.5 + */ +public class IncompleteAnnotationException extends RuntimeException { + private static final long serialVersionUID = 8445097402741811912L; + + private Class annotationType; + private String elementName; + + + /** + * Constructs an IncompleteAnnotationException to indicate that + * the named element was missing from the specified annotation type. + * + * @param annotationType the Class object for the annotation type + * @param elementName the name of the missing element + */ + public IncompleteAnnotationException( + Class annotationType, + String elementName) { + super(annotationType.getName() + " missing element " + elementName); + + this.annotationType = annotationType; + this.elementName = elementName; + } + + /** + * Returns the Class object for the annotation type with the + * missing element. + * + * @return the Class object for the annotation type with the + * missing element + */ + public Class annotationType() { + return annotationType; + } + + /** + * Returns the name of the missing element. + * + * @return the name of the missing element + */ + public String elementName() { + return elementName; + } +} diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/Inherited.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/Inherited.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2003, 2004, 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; + +/** + * Indicates that an annotation type is automatically inherited. If + * an Inherited meta-annotation is present on an annotation type + * declaration, and the user queries the annotation type on a class + * declaration, and the class declaration has no annotation for this type, + * then the class's superclass will automatically be queried for the + * annotation type. This process will be repeated until an annotation for this + * type is found, or the top of the class hierarchy (Object) + * is reached. If no superclass has an annotation for this type, then + * the query will indicate that the class in question has no such annotation. + * + *

Note that this meta-annotation type has no effect if the annotated + * type is used to annotate anything other than a class. Note also + * that this meta-annotation only causes annotations to be inherited + * from superclasses; annotations on implemented interfaces have no + * effect. + * + * @author Joshua Bloch + * @since 1.5 + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.ANNOTATION_TYPE) +public @interface Inherited { +} diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/Retention.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/Retention.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2003, 2006, 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; + +/** + * Indicates how long annotations with the annotated type are to + * be retained. If no Retention annotation is present on + * an annotation type declaration, the retention policy defaults to + * {@code RetentionPolicy.CLASS}. + * + *

A Retention meta-annotation has effect only if the + * meta-annotated type is used directly for annotation. It has no + * effect if the meta-annotated type is used as a member type in + * another annotation type. + * + * @author Joshua Bloch + * @since 1.5 + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.ANNOTATION_TYPE) +public @interface Retention { + RetentionPolicy value(); +} diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/RetentionPolicy.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/RetentionPolicy.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2003, 2004, 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; + +/** + * Annotation retention policy. The constants of this enumerated type + * describe the various policies for retaining annotations. They are used + * in conjunction with the {@link Retention} meta-annotation type to specify + * how long annotations are to be retained. + * + * @author Joshua Bloch + * @since 1.5 + */ +public enum RetentionPolicy { + /** + * Annotations are to be discarded by the compiler. + */ + SOURCE, + + /** + * Annotations are to be recorded in the class file by the compiler + * but need not be retained by the VM at run time. This is the default + * behavior. + */ + CLASS, + + /** + * Annotations are to be recorded in the class file by the compiler and + * retained by the VM at run time, so they may be read reflectively. + * + * @see java.lang.reflect.AnnotatedElement + */ + RUNTIME +} diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/Target.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/Target.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2003, 2004, 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; + +/** + * Indicates the kinds of program element to which an annotation type + * is applicable. If a Target meta-annotation is not present on an + * annotation type declaration, the declared type may be used on any + * program element. If such a meta-annotation is present, the compiler + * will enforce the specified usage restriction. + * + * For example, this meta-annotation indicates that the declared type is + * itself a meta-annotation type. It can only be used on annotation type + * declarations: + *

+ *    @Target(ElementType.ANNOTATION_TYPE)
+ *    public @interface MetaAnnotationType {
+ *        ...
+ *    }
+ * 
+ * This meta-annotation indicates that the declared type is intended solely + * for use as a member type in complex annotation type declarations. It + * cannot be used to annotate anything directly: + *
+ *    @Target({})
+ *    public @interface MemberType {
+ *        ...
+ *    }
+ * 
+ * It is a compile-time error for a single ElementType constant to + * appear more than once in a Target annotation. For example, the + * following meta-annotation is illegal: + *
+ *    @Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
+ *    public @interface Bogus {
+ *        ...
+ *    }
+ * 
+ */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.ANNOTATION_TYPE) +public @interface Target { + ElementType[] value(); +} diff -r 9ee9b36adb53 -r fdda72fd1f4f rt/emul/compact/src/main/java/java/lang/annotation/package-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/package-info.java Mon Oct 21 14:39:06 2013 +0200 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2004, 2006, 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. + */ + +/** + * Provides library support for the Java programming language + * annotation facility. + * + * @author Josh Bloch + * @since 1.5 + */ +package java.lang.annotation;