1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/Annotation.java Mon Oct 21 14:38:36 2013 +0200
1.3 @@ -0,0 +1,131 @@
1.4 +/*
1.5 + * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1.7 + *
1.8 + * This code is free software; you can redistribute it and/or modify it
1.9 + * under the terms of the GNU General Public License version 2 only, as
1.10 + * published by the Free Software Foundation. Oracle designates this
1.11 + * particular file as subject to the "Classpath" exception as provided
1.12 + * by Oracle in the LICENSE file that accompanied this code.
1.13 + *
1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1.17 + * version 2 for more details (a copy is included in the LICENSE file that
1.18 + * accompanied this code).
1.19 + *
1.20 + * You should have received a copy of the GNU General Public License version
1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1.23 + *
1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1.25 + * or visit www.oracle.com if you need additional information or have any
1.26 + * questions.
1.27 + */
1.28 +
1.29 +package java.lang.annotation;
1.30 +
1.31 +/**
1.32 + * The common interface extended by all annotation types. Note that an
1.33 + * interface that manually extends this one does <i>not</i> define
1.34 + * an annotation type. Also note that this interface does not itself
1.35 + * define an annotation type.
1.36 + *
1.37 + * More information about annotation types can be found in section 9.6 of
1.38 + * <cite>The Java™ Language Specification</cite>.
1.39 + *
1.40 + * @author Josh Bloch
1.41 + * @since 1.5
1.42 + */
1.43 +public interface Annotation {
1.44 + /**
1.45 + * Returns true if the specified object represents an annotation
1.46 + * that is logically equivalent to this one. In other words,
1.47 + * returns true if the specified object is an instance of the same
1.48 + * annotation type as this instance, all of whose members are equal
1.49 + * to the corresponding member of this annotation, as defined below:
1.50 + * <ul>
1.51 + * <li>Two corresponding primitive typed members whose values are
1.52 + * <tt>x</tt> and <tt>y</tt> are considered equal if <tt>x == y</tt>,
1.53 + * unless their type is <tt>float</tt> or <tt>double</tt>.
1.54 + *
1.55 + * <li>Two corresponding <tt>float</tt> members whose values
1.56 + * are <tt>x</tt> and <tt>y</tt> are considered equal if
1.57 + * <tt>Float.valueOf(x).equals(Float.valueOf(y))</tt>.
1.58 + * (Unlike the <tt>==</tt> operator, NaN is considered equal
1.59 + * to itself, and <tt>0.0f</tt> unequal to <tt>-0.0f</tt>.)
1.60 + *
1.61 + * <li>Two corresponding <tt>double</tt> members whose values
1.62 + * are <tt>x</tt> and <tt>y</tt> are considered equal if
1.63 + * <tt>Double.valueOf(x).equals(Double.valueOf(y))</tt>.
1.64 + * (Unlike the <tt>==</tt> operator, NaN is considered equal
1.65 + * to itself, and <tt>0.0</tt> unequal to <tt>-0.0</tt>.)
1.66 + *
1.67 + * <li>Two corresponding <tt>String</tt>, <tt>Class</tt>, enum, or
1.68 + * annotation typed members whose values are <tt>x</tt> and <tt>y</tt>
1.69 + * are considered equal if <tt>x.equals(y)</tt>. (Note that this
1.70 + * definition is recursive for annotation typed members.)
1.71 + *
1.72 + * <li>Two corresponding array typed members <tt>x</tt> and <tt>y</tt>
1.73 + * are considered equal if <tt>Arrays.equals(x, y)</tt>, for the
1.74 + * appropriate overloading of {@link java.util.Arrays#equals}.
1.75 + * </ul>
1.76 + *
1.77 + * @return true if the specified object represents an annotation
1.78 + * that is logically equivalent to this one, otherwise false
1.79 + */
1.80 + boolean equals(Object obj);
1.81 +
1.82 + /**
1.83 + * Returns the hash code of this annotation, as defined below:
1.84 + *
1.85 + * <p>The hash code of an annotation is the sum of the hash codes
1.86 + * of its members (including those with default values), as defined
1.87 + * below:
1.88 + *
1.89 + * The hash code of an annotation member is (127 times the hash code
1.90 + * of the member-name as computed by {@link String#hashCode()}) XOR
1.91 + * the hash code of the member-value, as defined below:
1.92 + *
1.93 + * <p>The hash code of a member-value depends on its type:
1.94 + * <ul>
1.95 + * <li>The hash code of a primitive value <tt><i>v</i></tt> is equal to
1.96 + * <tt><i>WrapperType</i>.valueOf(<i>v</i>).hashCode()</tt>, where
1.97 + * <tt><i>WrapperType</i></tt> is the wrapper type corresponding
1.98 + * to the primitive type of <tt><i>v</i></tt> ({@link Byte},
1.99 + * {@link Character}, {@link Double}, {@link Float}, {@link Integer},
1.100 + * {@link Long}, {@link Short}, or {@link Boolean}).
1.101 + *
1.102 + * <li>The hash code of a string, enum, class, or annotation member-value
1.103 + I <tt><i>v</i></tt> is computed as by calling
1.104 + * <tt><i>v</i>.hashCode()</tt>. (In the case of annotation
1.105 + * member values, this is a recursive definition.)
1.106 + *
1.107 + * <li>The hash code of an array member-value is computed by calling
1.108 + * the appropriate overloading of
1.109 + * {@link java.util.Arrays#hashCode(long[]) Arrays.hashCode}
1.110 + * on the value. (There is one overloading for each primitive
1.111 + * type, and one for object reference types.)
1.112 + * </ul>
1.113 + *
1.114 + * @return the hash code of this annotation
1.115 + */
1.116 + int hashCode();
1.117 +
1.118 + /**
1.119 + * Returns a string representation of this annotation. The details
1.120 + * of the representation are implementation-dependent, but the following
1.121 + * may be regarded as typical:
1.122 + * <pre>
1.123 + * @com.acme.util.Name(first=Alfred, middle=E., last=Neuman)
1.124 + * </pre>
1.125 + *
1.126 + * @return a string representation of this annotation
1.127 + */
1.128 + String toString();
1.129 +
1.130 + /**
1.131 + * Returns the annotation type of this annotation.
1.132 + */
1.133 + Class<? extends Annotation> annotationType();
1.134 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/AnnotationFormatError.java Mon Oct 21 14:38:36 2013 +0200
2.3 @@ -0,0 +1,79 @@
2.4 +/*
2.5 + * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2.7 + *
2.8 + * This code is free software; you can redistribute it and/or modify it
2.9 + * under the terms of the GNU General Public License version 2 only, as
2.10 + * published by the Free Software Foundation. Oracle designates this
2.11 + * particular file as subject to the "Classpath" exception as provided
2.12 + * by Oracle in the LICENSE file that accompanied this code.
2.13 + *
2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2.17 + * version 2 for more details (a copy is included in the LICENSE file that
2.18 + * accompanied this code).
2.19 + *
2.20 + * You should have received a copy of the GNU General Public License version
2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2.23 + *
2.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2.25 + * or visit www.oracle.com if you need additional information or have any
2.26 + * questions.
2.27 + */
2.28 +
2.29 +package java.lang.annotation;
2.30 +
2.31 +/**
2.32 + * Thrown when the annotation parser attempts to read an annotation
2.33 + * from a class file and determines that the annotation is malformed.
2.34 + * This error can be thrown by the {@linkplain
2.35 + * java.lang.reflect.AnnotatedElement API used to read annotations
2.36 + * reflectively}.
2.37 + *
2.38 + * @author Josh Bloch
2.39 + * @see java.lang.reflect.AnnotatedElement
2.40 + * @since 1.5
2.41 + */
2.42 +public class AnnotationFormatError extends Error {
2.43 + private static final long serialVersionUID = -4256701562333669892L;
2.44 +
2.45 + /**
2.46 + * Constructs a new <tt>AnnotationFormatError</tt> with the specified
2.47 + * detail message.
2.48 + *
2.49 + * @param message the detail message.
2.50 + */
2.51 + public AnnotationFormatError(String message) {
2.52 + super(message);
2.53 + }
2.54 +
2.55 + /**
2.56 + * Constructs a new <tt>AnnotationFormatError</tt> with the specified
2.57 + * detail message and cause. Note that the detail message associated
2.58 + * with <code>cause</code> is <i>not</i> automatically incorporated in
2.59 + * this error's detail message.
2.60 + *
2.61 + * @param message the detail message
2.62 + * @param cause the cause (A <tt>null</tt> value is permitted, and
2.63 + * indicates that the cause is nonexistent or unknown.)
2.64 + */
2.65 + public AnnotationFormatError(String message, Throwable cause) {
2.66 + super(message, cause);
2.67 + }
2.68 +
2.69 +
2.70 + /**
2.71 + * Constructs a new <tt>AnnotationFormatError</tt> with the specified
2.72 + * cause and a detail message of
2.73 + * <tt>(cause == null ? null : cause.toString())</tt> (which
2.74 + * typically contains the class and detail message of <tt>cause</tt>).
2.75 + *
2.76 + * @param cause the cause (A <tt>null</tt> value is permitted, and
2.77 + * indicates that the cause is nonexistent or unknown.)
2.78 + */
2.79 + public AnnotationFormatError(Throwable cause) {
2.80 + super(cause);
2.81 + }
2.82 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/AnnotationTypeMismatchException.java Mon Oct 21 14:38:36 2013 +0200
3.3 @@ -0,0 +1,91 @@
3.4 +/*
3.5 + * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3.7 + *
3.8 + * This code is free software; you can redistribute it and/or modify it
3.9 + * under the terms of the GNU General Public License version 2 only, as
3.10 + * published by the Free Software Foundation. Oracle designates this
3.11 + * particular file as subject to the "Classpath" exception as provided
3.12 + * by Oracle in the LICENSE file that accompanied this code.
3.13 + *
3.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
3.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3.17 + * version 2 for more details (a copy is included in the LICENSE file that
3.18 + * accompanied this code).
3.19 + *
3.20 + * You should have received a copy of the GNU General Public License version
3.21 + * 2 along with this work; if not, write to the Free Software Foundation,
3.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3.23 + *
3.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3.25 + * or visit www.oracle.com if you need additional information or have any
3.26 + * questions.
3.27 + */
3.28 +
3.29 +package java.lang.annotation;
3.30 +import java.lang.reflect.Method;
3.31 +
3.32 +/**
3.33 + * Thrown to indicate that a program has attempted to access an element of
3.34 + * an annotation whose type has changed after the annotation was compiled
3.35 + * (or serialized).
3.36 + * This exception can be thrown by the {@linkplain
3.37 + * java.lang.reflect.AnnotatedElement API used to read annotations
3.38 + * reflectively}.
3.39 + *
3.40 + * @author Josh Bloch
3.41 + * @see java.lang.reflect.AnnotatedElement
3.42 + * @since 1.5
3.43 + */
3.44 +public class AnnotationTypeMismatchException extends RuntimeException {
3.45 + private static final long serialVersionUID = 8125925355765570191L;
3.46 +
3.47 + /**
3.48 + * The <tt>Method</tt> object for the annotation element.
3.49 + */
3.50 + private final Method element;
3.51 +
3.52 + /**
3.53 + * The (erroneous) type of data found in the annotation. This string
3.54 + * may, but is not required to, contain the value as well. The exact
3.55 + * format of the string is unspecified.
3.56 + */
3.57 + private final String foundType;
3.58 +
3.59 + /**
3.60 + * Constructs an AnnotationTypeMismatchException for the specified
3.61 + * annotation type element and found data type.
3.62 + *
3.63 + * @param element the <tt>Method</tt> object for the annotation element
3.64 + * @param foundType the (erroneous) type of data found in the annotation.
3.65 + * This string may, but is not required to, contain the value
3.66 + * as well. The exact format of the string is unspecified.
3.67 + */
3.68 + public AnnotationTypeMismatchException(Method element, String foundType) {
3.69 + super("Incorrectly typed data found for annotation element " + element
3.70 + + " (Found data of type " + foundType + ")");
3.71 + this.element = element;
3.72 + this.foundType = foundType;
3.73 + }
3.74 +
3.75 + /**
3.76 + * Returns the <tt>Method</tt> object for the incorrectly typed element.
3.77 + *
3.78 + * @return the <tt>Method</tt> object for the incorrectly typed element
3.79 + */
3.80 + public Method element() {
3.81 + return this.element;
3.82 + }
3.83 +
3.84 + /**
3.85 + * Returns the type of data found in the incorrectly typed element.
3.86 + * The returned string may, but is not required to, contain the value
3.87 + * as well. The exact format of the string is unspecified.
3.88 + *
3.89 + * @return the type of data found in the incorrectly typed element
3.90 + */
3.91 + public String foundType() {
3.92 + return this.foundType;
3.93 + }
3.94 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/Documented.java Mon Oct 21 14:38:36 2013 +0200
4.3 @@ -0,0 +1,43 @@
4.4 +/*
4.5 + * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4.7 + *
4.8 + * This code is free software; you can redistribute it and/or modify it
4.9 + * under the terms of the GNU General Public License version 2 only, as
4.10 + * published by the Free Software Foundation. Oracle designates this
4.11 + * particular file as subject to the "Classpath" exception as provided
4.12 + * by Oracle in the LICENSE file that accompanied this code.
4.13 + *
4.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
4.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4.17 + * version 2 for more details (a copy is included in the LICENSE file that
4.18 + * accompanied this code).
4.19 + *
4.20 + * You should have received a copy of the GNU General Public License version
4.21 + * 2 along with this work; if not, write to the Free Software Foundation,
4.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4.23 + *
4.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4.25 + * or visit www.oracle.com if you need additional information or have any
4.26 + * questions.
4.27 + */
4.28 +
4.29 +package java.lang.annotation;
4.30 +
4.31 +/**
4.32 + * Indicates that annotations with a type are to be documented by javadoc
4.33 + * and similar tools by default. This type should be used to annotate the
4.34 + * declarations of types whose annotations affect the use of annotated
4.35 + * elements by their clients. If a type declaration is annotated with
4.36 + * Documented, its annotations become part of the public API
4.37 + * of the annotated elements.
4.38 + *
4.39 + * @author Joshua Bloch
4.40 + * @since 1.5
4.41 + */
4.42 +@Documented
4.43 +@Retention(RetentionPolicy.RUNTIME)
4.44 +@Target(ElementType.ANNOTATION_TYPE)
4.45 +public @interface Documented {
4.46 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/ElementType.java Mon Oct 21 14:38:36 2013 +0200
5.3 @@ -0,0 +1,63 @@
5.4 +/*
5.5 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5.7 + *
5.8 + * This code is free software; you can redistribute it and/or modify it
5.9 + * under the terms of the GNU General Public License version 2 only, as
5.10 + * published by the Free Software Foundation. Oracle designates this
5.11 + * particular file as subject to the "Classpath" exception as provided
5.12 + * by Oracle in the LICENSE file that accompanied this code.
5.13 + *
5.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
5.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5.17 + * version 2 for more details (a copy is included in the LICENSE file that
5.18 + * accompanied this code).
5.19 + *
5.20 + * You should have received a copy of the GNU General Public License version
5.21 + * 2 along with this work; if not, write to the Free Software Foundation,
5.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5.23 + *
5.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5.25 + * or visit www.oracle.com if you need additional information or have any
5.26 + * questions.
5.27 + */
5.28 +
5.29 +package java.lang.annotation;
5.30 +
5.31 +/**
5.32 + * A program element type. The constants of this enumerated type
5.33 + * provide a simple classification of the declared elements in a
5.34 + * Java program.
5.35 + *
5.36 + * <p>These constants are used with the {@link Target} meta-annotation type
5.37 + * to specify where it is legal to use an annotation type.
5.38 + *
5.39 + * @author Joshua Bloch
5.40 + * @since 1.5
5.41 + */
5.42 +public enum ElementType {
5.43 + /** Class, interface (including annotation type), or enum declaration */
5.44 + TYPE,
5.45 +
5.46 + /** Field declaration (includes enum constants) */
5.47 + FIELD,
5.48 +
5.49 + /** Method declaration */
5.50 + METHOD,
5.51 +
5.52 + /** Parameter declaration */
5.53 + PARAMETER,
5.54 +
5.55 + /** Constructor declaration */
5.56 + CONSTRUCTOR,
5.57 +
5.58 + /** Local variable declaration */
5.59 + LOCAL_VARIABLE,
5.60 +
5.61 + /** Annotation type declaration */
5.62 + ANNOTATION_TYPE,
5.63 +
5.64 + /** Package declaration */
5.65 + PACKAGE
5.66 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/IncompleteAnnotationException.java Mon Oct 21 14:38:36 2013 +0200
6.3 @@ -0,0 +1,83 @@
6.4 +/*
6.5 + * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6.7 + *
6.8 + * This code is free software; you can redistribute it and/or modify it
6.9 + * under the terms of the GNU General Public License version 2 only, as
6.10 + * published by the Free Software Foundation. Oracle designates this
6.11 + * particular file as subject to the "Classpath" exception as provided
6.12 + * by Oracle in the LICENSE file that accompanied this code.
6.13 + *
6.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
6.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6.17 + * version 2 for more details (a copy is included in the LICENSE file that
6.18 + * accompanied this code).
6.19 + *
6.20 + * You should have received a copy of the GNU General Public License version
6.21 + * 2 along with this work; if not, write to the Free Software Foundation,
6.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6.23 + *
6.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6.25 + * or visit www.oracle.com if you need additional information or have any
6.26 + * questions.
6.27 + */
6.28 +
6.29 +package java.lang.annotation;
6.30 +
6.31 +/**
6.32 + * Thrown to indicate that a program has attempted to access an element of
6.33 + * an annotation type that was added to the annotation type definition after
6.34 + * the annotation was compiled (or serialized). This exception will not be
6.35 + * thrown if the new element has a default value.
6.36 + * This exception can be thrown by the {@linkplain
6.37 + * java.lang.reflect.AnnotatedElement API used to read annotations
6.38 + * reflectively}.
6.39 + *
6.40 + * @author Josh Bloch
6.41 + * @see java.lang.reflect.AnnotatedElement
6.42 + * @since 1.5
6.43 + */
6.44 +public class IncompleteAnnotationException extends RuntimeException {
6.45 + private static final long serialVersionUID = 8445097402741811912L;
6.46 +
6.47 + private Class annotationType;
6.48 + private String elementName;
6.49 +
6.50 +
6.51 + /**
6.52 + * Constructs an IncompleteAnnotationException to indicate that
6.53 + * the named element was missing from the specified annotation type.
6.54 + *
6.55 + * @param annotationType the Class object for the annotation type
6.56 + * @param elementName the name of the missing element
6.57 + */
6.58 + public IncompleteAnnotationException(
6.59 + Class<? extends Annotation> annotationType,
6.60 + String elementName) {
6.61 + super(annotationType.getName() + " missing element " + elementName);
6.62 +
6.63 + this.annotationType = annotationType;
6.64 + this.elementName = elementName;
6.65 + }
6.66 +
6.67 + /**
6.68 + * Returns the Class object for the annotation type with the
6.69 + * missing element.
6.70 + *
6.71 + * @return the Class object for the annotation type with the
6.72 + * missing element
6.73 + */
6.74 + public Class<? extends Annotation> annotationType() {
6.75 + return annotationType;
6.76 + }
6.77 +
6.78 + /**
6.79 + * Returns the name of the missing element.
6.80 + *
6.81 + * @return the name of the missing element
6.82 + */
6.83 + public String elementName() {
6.84 + return elementName;
6.85 + }
6.86 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/Inherited.java Mon Oct 21 14:38:36 2013 +0200
7.3 @@ -0,0 +1,52 @@
7.4 +/*
7.5 + * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7.7 + *
7.8 + * This code is free software; you can redistribute it and/or modify it
7.9 + * under the terms of the GNU General Public License version 2 only, as
7.10 + * published by the Free Software Foundation. Oracle designates this
7.11 + * particular file as subject to the "Classpath" exception as provided
7.12 + * by Oracle in the LICENSE file that accompanied this code.
7.13 + *
7.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
7.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7.17 + * version 2 for more details (a copy is included in the LICENSE file that
7.18 + * accompanied this code).
7.19 + *
7.20 + * You should have received a copy of the GNU General Public License version
7.21 + * 2 along with this work; if not, write to the Free Software Foundation,
7.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7.23 + *
7.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7.25 + * or visit www.oracle.com if you need additional information or have any
7.26 + * questions.
7.27 + */
7.28 +
7.29 +package java.lang.annotation;
7.30 +
7.31 +/**
7.32 + * Indicates that an annotation type is automatically inherited. If
7.33 + * an Inherited meta-annotation is present on an annotation type
7.34 + * declaration, and the user queries the annotation type on a class
7.35 + * declaration, and the class declaration has no annotation for this type,
7.36 + * then the class's superclass will automatically be queried for the
7.37 + * annotation type. This process will be repeated until an annotation for this
7.38 + * type is found, or the top of the class hierarchy (Object)
7.39 + * is reached. If no superclass has an annotation for this type, then
7.40 + * the query will indicate that the class in question has no such annotation.
7.41 + *
7.42 + * <p>Note that this meta-annotation type has no effect if the annotated
7.43 + * type is used to annotate anything other than a class. Note also
7.44 + * that this meta-annotation only causes annotations to be inherited
7.45 + * from superclasses; annotations on implemented interfaces have no
7.46 + * effect.
7.47 + *
7.48 + * @author Joshua Bloch
7.49 + * @since 1.5
7.50 + */
7.51 +@Documented
7.52 +@Retention(RetentionPolicy.RUNTIME)
7.53 +@Target(ElementType.ANNOTATION_TYPE)
7.54 +public @interface Inherited {
7.55 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/Retention.java Mon Oct 21 14:38:36 2013 +0200
8.3 @@ -0,0 +1,47 @@
8.4 +/*
8.5 + * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8.7 + *
8.8 + * This code is free software; you can redistribute it and/or modify it
8.9 + * under the terms of the GNU General Public License version 2 only, as
8.10 + * published by the Free Software Foundation. Oracle designates this
8.11 + * particular file as subject to the "Classpath" exception as provided
8.12 + * by Oracle in the LICENSE file that accompanied this code.
8.13 + *
8.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
8.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8.17 + * version 2 for more details (a copy is included in the LICENSE file that
8.18 + * accompanied this code).
8.19 + *
8.20 + * You should have received a copy of the GNU General Public License version
8.21 + * 2 along with this work; if not, write to the Free Software Foundation,
8.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8.23 + *
8.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8.25 + * or visit www.oracle.com if you need additional information or have any
8.26 + * questions.
8.27 + */
8.28 +
8.29 +package java.lang.annotation;
8.30 +
8.31 +/**
8.32 + * Indicates how long annotations with the annotated type are to
8.33 + * be retained. If no Retention annotation is present on
8.34 + * an annotation type declaration, the retention policy defaults to
8.35 + * {@code RetentionPolicy.CLASS}.
8.36 + *
8.37 + * <p>A Retention meta-annotation has effect only if the
8.38 + * meta-annotated type is used directly for annotation. It has no
8.39 + * effect if the meta-annotated type is used as a member type in
8.40 + * another annotation type.
8.41 + *
8.42 + * @author Joshua Bloch
8.43 + * @since 1.5
8.44 + */
8.45 +@Documented
8.46 +@Retention(RetentionPolicy.RUNTIME)
8.47 +@Target(ElementType.ANNOTATION_TYPE)
8.48 +public @interface Retention {
8.49 + RetentionPolicy value();
8.50 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/RetentionPolicy.java Mon Oct 21 14:38:36 2013 +0200
9.3 @@ -0,0 +1,57 @@
9.4 +/*
9.5 + * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9.7 + *
9.8 + * This code is free software; you can redistribute it and/or modify it
9.9 + * under the terms of the GNU General Public License version 2 only, as
9.10 + * published by the Free Software Foundation. Oracle designates this
9.11 + * particular file as subject to the "Classpath" exception as provided
9.12 + * by Oracle in the LICENSE file that accompanied this code.
9.13 + *
9.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
9.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9.17 + * version 2 for more details (a copy is included in the LICENSE file that
9.18 + * accompanied this code).
9.19 + *
9.20 + * You should have received a copy of the GNU General Public License version
9.21 + * 2 along with this work; if not, write to the Free Software Foundation,
9.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9.23 + *
9.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9.25 + * or visit www.oracle.com if you need additional information or have any
9.26 + * questions.
9.27 + */
9.28 +
9.29 +package java.lang.annotation;
9.30 +
9.31 +/**
9.32 + * Annotation retention policy. The constants of this enumerated type
9.33 + * describe the various policies for retaining annotations. They are used
9.34 + * in conjunction with the {@link Retention} meta-annotation type to specify
9.35 + * how long annotations are to be retained.
9.36 + *
9.37 + * @author Joshua Bloch
9.38 + * @since 1.5
9.39 + */
9.40 +public enum RetentionPolicy {
9.41 + /**
9.42 + * Annotations are to be discarded by the compiler.
9.43 + */
9.44 + SOURCE,
9.45 +
9.46 + /**
9.47 + * Annotations are to be recorded in the class file by the compiler
9.48 + * but need not be retained by the VM at run time. This is the default
9.49 + * behavior.
9.50 + */
9.51 + CLASS,
9.52 +
9.53 + /**
9.54 + * Annotations are to be recorded in the class file by the compiler and
9.55 + * retained by the VM at run time, so they may be read reflectively.
9.56 + *
9.57 + * @see java.lang.reflect.AnnotatedElement
9.58 + */
9.59 + RUNTIME
9.60 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/Target.java Mon Oct 21 14:38:36 2013 +0200
10.3 @@ -0,0 +1,68 @@
10.4 +/*
10.5 + * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10.7 + *
10.8 + * This code is free software; you can redistribute it and/or modify it
10.9 + * under the terms of the GNU General Public License version 2 only, as
10.10 + * published by the Free Software Foundation. Oracle designates this
10.11 + * particular file as subject to the "Classpath" exception as provided
10.12 + * by Oracle in the LICENSE file that accompanied this code.
10.13 + *
10.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
10.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10.17 + * version 2 for more details (a copy is included in the LICENSE file that
10.18 + * accompanied this code).
10.19 + *
10.20 + * You should have received a copy of the GNU General Public License version
10.21 + * 2 along with this work; if not, write to the Free Software Foundation,
10.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
10.23 + *
10.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10.25 + * or visit www.oracle.com if you need additional information or have any
10.26 + * questions.
10.27 + */
10.28 +
10.29 +package java.lang.annotation;
10.30 +
10.31 +/**
10.32 + * Indicates the kinds of program element to which an annotation type
10.33 + * is applicable. If a Target meta-annotation is not present on an
10.34 + * annotation type declaration, the declared type may be used on any
10.35 + * program element. If such a meta-annotation is present, the compiler
10.36 + * will enforce the specified usage restriction.
10.37 + *
10.38 + * For example, this meta-annotation indicates that the declared type is
10.39 + * itself a meta-annotation type. It can only be used on annotation type
10.40 + * declarations:
10.41 + * <pre>
10.42 + * @Target(ElementType.ANNOTATION_TYPE)
10.43 + * public @interface MetaAnnotationType {
10.44 + * ...
10.45 + * }
10.46 + * </pre>
10.47 + * This meta-annotation indicates that the declared type is intended solely
10.48 + * for use as a member type in complex annotation type declarations. It
10.49 + * cannot be used to annotate anything directly:
10.50 + * <pre>
10.51 + * @Target({})
10.52 + * public @interface MemberType {
10.53 + * ...
10.54 + * }
10.55 + * </pre>
10.56 + * It is a compile-time error for a single ElementType constant to
10.57 + * appear more than once in a Target annotation. For example, the
10.58 + * following meta-annotation is illegal:
10.59 + * <pre>
10.60 + * @Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
10.61 + * public @interface Bogus {
10.62 + * ...
10.63 + * }
10.64 + * </pre>
10.65 + */
10.66 +@Documented
10.67 +@Retention(RetentionPolicy.RUNTIME)
10.68 +@Target(ElementType.ANNOTATION_TYPE)
10.69 +public @interface Target {
10.70 + ElementType[] value();
10.71 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/rt/emul/compact/src/main/java/java/lang/annotation/package-info.java Mon Oct 21 14:38:36 2013 +0200
11.3 @@ -0,0 +1,33 @@
11.4 +/*
11.5 + * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11.7 + *
11.8 + * This code is free software; you can redistribute it and/or modify it
11.9 + * under the terms of the GNU General Public License version 2 only, as
11.10 + * published by the Free Software Foundation. Oracle designates this
11.11 + * particular file as subject to the "Classpath" exception as provided
11.12 + * by Oracle in the LICENSE file that accompanied this code.
11.13 + *
11.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
11.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11.17 + * version 2 for more details (a copy is included in the LICENSE file that
11.18 + * accompanied this code).
11.19 + *
11.20 + * You should have received a copy of the GNU General Public License version
11.21 + * 2 along with this work; if not, write to the Free Software Foundation,
11.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
11.23 + *
11.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
11.25 + * or visit www.oracle.com if you need additional information or have any
11.26 + * questions.
11.27 + */
11.28 +
11.29 +/**
11.30 + * Provides library support for the Java programming language
11.31 + * annotation facility.
11.32 + *
11.33 + * @author Josh Bloch
11.34 + * @since 1.5
11.35 + */
11.36 +package java.lang.annotation;