History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/java/lang/annotation (22 of 18352 files). Show all

Unified · Split

22 files
  1. java/pkg/java/lang/annotation/Annotation.class +0 −0
  2. java/pkg/java/lang/annotation/Annotation.java +131 −0
  3. java/pkg/java/lang/annotation/AnnotationFormatError.class +0 −0
  4. java/pkg/java/lang/annotation/AnnotationFormatError.java +79 −0
  5. java/pkg/java/lang/annotation/AnnotationTypeMismatchException.class +0 −0
  6. java/pkg/java/lang/annotation/AnnotationTypeMismatchException.java +91 −0
  7. java/pkg/java/lang/annotation/Documented.class +0 −0
  8. java/pkg/java/lang/annotation/Documented.java +43 −0
  9. java/pkg/java/lang/annotation/ElementType.class +0 −0
  10. java/pkg/java/lang/annotation/ElementType.java +63 −0
  11. java/pkg/java/lang/annotation/IncompleteAnnotationException.class +0 −0
  12. java/pkg/java/lang/annotation/IncompleteAnnotationException.java +83 −0
  13. java/pkg/java/lang/annotation/Inherited.class +0 −0
  14. java/pkg/java/lang/annotation/Inherited.java +52 −0
  15. java/pkg/java/lang/annotation/Retention.class +0 −0
  16. java/pkg/java/lang/annotation/Retention.java +47 −0
  17. java/pkg/java/lang/annotation/RetentionPolicy.class +0 −0
  18. java/pkg/java/lang/annotation/RetentionPolicy.java +57 −0
  19. java/pkg/java/lang/annotation/Target.class +0 −0
  20. java/pkg/java/lang/annotation/Target.java +68 −0
  21. java/pkg/java/lang/annotation/mkfile +18 −0
  22. java/pkg/java/lang/annotation/package-info.java +33 −0
java/pkg/java/lang/annotation/Annotation.class+0−0

Binary file not shown.

java/pkg/java/lang/annotation/Annotation.java+131−0
@@ -0,0 +1,131 @@
1/*
2 * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.lang.annotation;
27
28/**
29 * The common interface extended by all annotation types. Note that an
30 * interface that manually extends this one does <i>not</i> define
31 * an annotation type. Also note that this interface does not itself
32 * define an annotation type.
33 *
34 * More information about annotation types can be found in section 9.6 of
35 * <cite>The Java&trade; Language Specification</cite>.
36 *
37 * @author Josh Bloch
38 * @since 1.5
39 */
40public interface Annotation {
41 /**
42 * Returns true if the specified object represents an annotation
43 * that is logically equivalent to this one. In other words,
44 * returns true if the specified object is an instance of the same
45 * annotation type as this instance, all of whose members are equal
46 * to the corresponding member of this annotation, as defined below:
47 * <ul>
48 * <li>Two corresponding primitive typed members whose values are
49 * <tt>x</tt> and <tt>y</tt> are considered equal if <tt>x == y</tt>,
50 * unless their type is <tt>float</tt> or <tt>double</tt>.
51 *
52 * <li>Two corresponding <tt>float</tt> members whose values
53 * are <tt>x</tt> and <tt>y</tt> are considered equal if
54 * <tt>Float.valueOf(x).equals(Float.valueOf(y))</tt>.
55 * (Unlike the <tt>==</tt> operator, NaN is considered equal
56 * to itself, and <tt>0.0f</tt> unequal to <tt>-0.0f</tt>.)
57 *
58 * <li>Two corresponding <tt>double</tt> members whose values
59 * are <tt>x</tt> and <tt>y</tt> are considered equal if
60 * <tt>Double.valueOf(x).equals(Double.valueOf(y))</tt>.
61 * (Unlike the <tt>==</tt> operator, NaN is considered equal
62 * to itself, and <tt>0.0</tt> unequal to <tt>-0.0</tt>.)
63 *
64 * <li>Two corresponding <tt>String</tt>, <tt>Class</tt>, enum, or
65 * annotation typed members whose values are <tt>x</tt> and <tt>y</tt>
66 * are considered equal if <tt>x.equals(y)</tt>. (Note that this
67 * definition is recursive for annotation typed members.)
68 *
69 * <li>Two corresponding array typed members <tt>x</tt> and <tt>y</tt>
70 * are considered equal if <tt>Arrays.equals(x, y)</tt>, for the
71 * appropriate overloading of {@link java.util.Arrays#equals}.
72 * </ul>
73 *
74 * @return true if the specified object represents an annotation
75 * that is logically equivalent to this one, otherwise false
76 */
77 boolean equals(Object obj);
78
79 /**
80 * Returns the hash code of this annotation, as defined below:
81 *
82 * <p>The hash code of an annotation is the sum of the hash codes
83 * of its members (including those with default values), as defined
84 * below:
85 *
86 * The hash code of an annotation member is (127 times the hash code
87 * of the member-name as computed by {@link String#hashCode()}) XOR
88 * the hash code of the member-value, as defined below:
89 *
90 * <p>The hash code of a member-value depends on its type:
91 * <ul>
92 * <li>The hash code of a primitive value <tt><i>v</i></tt> is equal to
93 * <tt><i>WrapperType</i>.valueOf(<i>v</i>).hashCode()</tt>, where
94 * <tt><i>WrapperType</i></tt> is the wrapper type corresponding
95 * to the primitive type of <tt><i>v</i></tt> ({@link Byte},
96 * {@link Character}, {@link Double}, {@link Float}, {@link Integer},
97 * {@link Long}, {@link Short}, or {@link Boolean}).
98 *
99 * <li>The hash code of a string, enum, class, or annotation member-value
100 I <tt><i>v</i></tt> is computed as by calling
101 * <tt><i>v</i>.hashCode()</tt>. (In the case of annotation
102 * member values, this is a recursive definition.)
103 *
104 * <li>The hash code of an array member-value is computed by calling
105 * the appropriate overloading of
106 * {@link java.util.Arrays#hashCode(long[]) Arrays.hashCode}
107 * on the value. (There is one overloading for each primitive
108 * type, and one for object reference types.)
109 * </ul>
110 *
111 * @return the hash code of this annotation
112 */
113 int hashCode();
114
115 /**
116 * Returns a string representation of this annotation. The details
117 * of the representation are implementation-dependent, but the following
118 * may be regarded as typical:
119 * <pre>
120 * &#064;com.acme.util.Name(first=Alfred, middle=E., last=Neuman)
121 * </pre>
122 *
123 * @return a string representation of this annotation
124 */
125 String toString();
126
127 /**
128 * Returns the annotation type of this annotation.
129 */
130 Class<? extends Annotation> annotationType();
131}
java/pkg/java/lang/annotation/AnnotationFormatError.class+0−0

Binary file not shown.

java/pkg/java/lang/annotation/AnnotationFormatError.java+79−0
@@ -0,0 +1,79 @@
1/*
2 * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.lang.annotation;
27
28/**
29 * Thrown when the annotation parser attempts to read an annotation
30 * from a class file and determines that the annotation is malformed.
31 * This error can be thrown by the {@linkplain
32 * java.lang.reflect.AnnotatedElement API used to read annotations
33 * reflectively}.
34 *
35 * @author Josh Bloch
36 * @see java.lang.reflect.AnnotatedElement
37 * @since 1.5
38 */
39public class AnnotationFormatError extends Error {
40 private static final long serialVersionUID = -4256701562333669892L;
41
42 /**
43 * Constructs a new <tt>AnnotationFormatError</tt> with the specified
44 * detail message.
45 *
46 * @param message the detail message.
47 */
48 public AnnotationFormatError(String message) {
49 super(message);
50 }
51
52 /**
53 * Constructs a new <tt>AnnotationFormatError</tt> with the specified
54 * detail message and cause. Note that the detail message associated
55 * with <code>cause</code> is <i>not</i> automatically incorporated in
56 * this error's detail message.
57 *
58 * @param message the detail message
59 * @param cause the cause (A <tt>null</tt> value is permitted, and
60 * indicates that the cause is nonexistent or unknown.)
61 */
62 public AnnotationFormatError(String message, Throwable cause) {
63 super(message, cause);
64 }
65
66
67 /**
68 * Constructs a new <tt>AnnotationFormatError</tt> with the specified
69 * cause and a detail message of
70 * <tt>(cause == null ? null : cause.toString())</tt> (which
71 * typically contains the class and detail message of <tt>cause</tt>).
72 *
73 * @param cause the cause (A <tt>null</tt> value is permitted, and
74 * indicates that the cause is nonexistent or unknown.)
75 */
76 public AnnotationFormatError(Throwable cause) {
77 super(cause);
78 }
79}
java/pkg/java/lang/annotation/AnnotationTypeMismatchException.class+0−0

Binary file not shown.

java/pkg/java/lang/annotation/AnnotationTypeMismatchException.java+91−0
@@ -0,0 +1,91 @@
1/*
2 * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.lang.annotation;
27import java.lang.reflect.Method;
28
29/**
30 * Thrown to indicate that a program has attempted to access an element of
31 * an annotation whose type has changed after the annotation was compiled
32 * (or serialized).
33 * This exception can be thrown by the {@linkplain
34 * java.lang.reflect.AnnotatedElement API used to read annotations
35 * reflectively}.
36 *
37 * @author Josh Bloch
38 * @see java.lang.reflect.AnnotatedElement
39 * @since 1.5
40 */
41public class AnnotationTypeMismatchException extends RuntimeException {
42 private static final long serialVersionUID = 8125925355765570191L;
43
44 /**
45 * The <tt>Method</tt> object for the annotation element.
46 */
47 private final Method element;
48
49 /**
50 * The (erroneous) type of data found in the annotation. This string
51 * may, but is not required to, contain the value as well. The exact
52 * format of the string is unspecified.
53 */
54 private final String foundType;
55
56 /**
57 * Constructs an AnnotationTypeMismatchException for the specified
58 * annotation type element and found data type.
59 *
60 * @param element the <tt>Method</tt> object for the annotation element
61 * @param foundType the (erroneous) type of data found in the annotation.
62 * This string may, but is not required to, contain the value
63 * as well. The exact format of the string is unspecified.
64 */
65 public AnnotationTypeMismatchException(Method element, String foundType) {
66 super("Incorrectly typed data found for annotation element " + element
67 + " (Found data of type " + foundType + ")");
68 this.element = element;
69 this.foundType = foundType;
70 }
71
72 /**
73 * Returns the <tt>Method</tt> object for the incorrectly typed element.
74 *
75 * @return the <tt>Method</tt> object for the incorrectly typed element
76 */
77 public Method element() {
78 return this.element;
79 }
80
81 /**
82 * Returns the type of data found in the incorrectly typed element.
83 * The returned string may, but is not required to, contain the value
84 * as well. The exact format of the string is unspecified.
85 *
86 * @return the type of data found in the incorrectly typed element
87 */
88 public String foundType() {
89 return this.foundType;
90 }
91}
java/pkg/java/lang/annotation/Documented.class+0−0

Binary file not shown.

java/pkg/java/lang/annotation/Documented.java+43−0
@@ -0,0 +1,43 @@
1/*
2 * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.lang.annotation;
27
28/**
29 * Indicates that annotations with a type are to be documented by javadoc
30 * and similar tools by default. This type should be used to annotate the
31 * declarations of types whose annotations affect the use of annotated
32 * elements by their clients. If a type declaration is annotated with
33 * Documented, its annotations become part of the public API
34 * of the annotated elements.
35 *
36 * @author Joshua Bloch
37 * @since 1.5
38 */
39@Documented
40@Retention(RetentionPolicy.RUNTIME)
41@Target(ElementType.ANNOTATION_TYPE)
42public @interface Documented {
43}
java/pkg/java/lang/annotation/ElementType.class+0−0

Binary file not shown.

java/pkg/java/lang/annotation/ElementType.java+63−0
@@ -0,0 +1,63 @@
1/*
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.lang.annotation;
27
28/**
29 * A program element type. The constants of this enumerated type
30 * provide a simple classification of the declared elements in a
31 * Java program.
32 *
33 * <p>These constants are used with the {@link Target} meta-annotation type
34 * to specify where it is legal to use an annotation type.
35 *
36 * @author Joshua Bloch
37 * @since 1.5
38 */
39public enum ElementType {
40 /** Class, interface (including annotation type), or enum declaration */
41 TYPE,
42
43 /** Field declaration (includes enum constants) */
44 FIELD,
45
46 /** Method declaration */
47 METHOD,
48
49 /** Parameter declaration */
50 PARAMETER,
51
52 /** Constructor declaration */
53 CONSTRUCTOR,
54
55 /** Local variable declaration */
56 LOCAL_VARIABLE,
57
58 /** Annotation type declaration */
59 ANNOTATION_TYPE,
60
61 /** Package declaration */
62 PACKAGE
63}
java/pkg/java/lang/annotation/IncompleteAnnotationException.class+0−0

Binary file not shown.

java/pkg/java/lang/annotation/IncompleteAnnotationException.java+83−0
@@ -0,0 +1,83 @@
1/*
2 * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.lang.annotation;
27
28/**
29 * Thrown to indicate that a program has attempted to access an element of
30 * an annotation type that was added to the annotation type definition after
31 * the annotation was compiled (or serialized). This exception will not be
32 * thrown if the new element has a default value.
33 * This exception can be thrown by the {@linkplain
34 * java.lang.reflect.AnnotatedElement API used to read annotations
35 * reflectively}.
36 *
37 * @author Josh Bloch
38 * @see java.lang.reflect.AnnotatedElement
39 * @since 1.5
40 */
41public class IncompleteAnnotationException extends RuntimeException {
42 private static final long serialVersionUID = 8445097402741811912L;
43
44 private Class annotationType;
45 private String elementName;
46
47
48 /**
49 * Constructs an IncompleteAnnotationException to indicate that
50 * the named element was missing from the specified annotation type.
51 *
52 * @param annotationType the Class object for the annotation type
53 * @param elementName the name of the missing element
54 */
55 public IncompleteAnnotationException(
56 Class<? extends Annotation> annotationType,
57 String elementName) {
58 super(annotationType.getName() + " missing element " + elementName);
59
60 this.annotationType = annotationType;
61 this.elementName = elementName;
62 }
63
64 /**
65 * Returns the Class object for the annotation type with the
66 * missing element.
67 *
68 * @return the Class object for the annotation type with the
69 * missing element
70 */
71 public Class<? extends Annotation> annotationType() {
72 return annotationType;
73 }
74
75 /**
76 * Returns the name of the missing element.
77 *
78 * @return the name of the missing element
79 */
80 public String elementName() {
81 return elementName;
82 }
83}
java/pkg/java/lang/annotation/Inherited.class+0−0

Binary file not shown.

java/pkg/java/lang/annotation/Inherited.java+52−0
@@ -0,0 +1,52 @@
1/*
2 * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.lang.annotation;
27
28/**
29 * Indicates that an annotation type is automatically inherited. If
30 * an Inherited meta-annotation is present on an annotation type
31 * declaration, and the user queries the annotation type on a class
32 * declaration, and the class declaration has no annotation for this type,
33 * then the class's superclass will automatically be queried for the
34 * annotation type. This process will be repeated until an annotation for this
35 * type is found, or the top of the class hierarchy (Object)
36 * is reached. If no superclass has an annotation for this type, then
37 * the query will indicate that the class in question has no such annotation.
38 *
39 * <p>Note that this meta-annotation type has no effect if the annotated
40 * type is used to annotate anything other than a class. Note also
41 * that this meta-annotation only causes annotations to be inherited
42 * from superclasses; annotations on implemented interfaces have no
43 * effect.
44 *
45 * @author Joshua Bloch
46 * @since 1.5
47 */
48@Documented
49@Retention(RetentionPolicy.RUNTIME)
50@Target(ElementType.ANNOTATION_TYPE)
51public @interface Inherited {
52}
java/pkg/java/lang/annotation/Retention.class+0−0

Binary file not shown.

java/pkg/java/lang/annotation/Retention.java+47−0
@@ -0,0 +1,47 @@
1/*
2 * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.lang.annotation;
27
28/**
29 * Indicates how long annotations with the annotated type are to
30 * be retained. If no Retention annotation is present on
31 * an annotation type declaration, the retention policy defaults to
32 * {@code RetentionPolicy.CLASS}.
33 *
34 * <p>A Retention meta-annotation has effect only if the
35 * meta-annotated type is used directly for annotation. It has no
36 * effect if the meta-annotated type is used as a member type in
37 * another annotation type.
38 *
39 * @author Joshua Bloch
40 * @since 1.5
41 */
42@Documented
43@Retention(RetentionPolicy.RUNTIME)
44@Target(ElementType.ANNOTATION_TYPE)
45public @interface Retention {
46 RetentionPolicy value();
47}
java/pkg/java/lang/annotation/RetentionPolicy.class+0−0

Binary file not shown.

java/pkg/java/lang/annotation/RetentionPolicy.java+57−0
@@ -0,0 +1,57 @@
1/*
2 * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.lang.annotation;
27
28/**
29 * Annotation retention policy. The constants of this enumerated type
30 * describe the various policies for retaining annotations. They are used
31 * in conjunction with the {@link Retention} meta-annotation type to specify
32 * how long annotations are to be retained.
33 *
34 * @author Joshua Bloch
35 * @since 1.5
36 */
37public enum RetentionPolicy {
38 /**
39 * Annotations are to be discarded by the compiler.
40 */
41 SOURCE,
42
43 /**
44 * Annotations are to be recorded in the class file by the compiler
45 * but need not be retained by the VM at run time. This is the default
46 * behavior.
47 */
48 CLASS,
49
50 /**
51 * Annotations are to be recorded in the class file by the compiler and
52 * retained by the VM at run time, so they may be read reflectively.
53 *
54 * @see java.lang.reflect.AnnotatedElement
55 */
56 RUNTIME
57}
java/pkg/java/lang/annotation/Target.class+0−0

Binary file not shown.

java/pkg/java/lang/annotation/Target.java+68−0
@@ -0,0 +1,68 @@
1/*
2 * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.lang.annotation;
27
28/**
29 * Indicates the kinds of program element to which an annotation type
30 * is applicable. If a Target meta-annotation is not present on an
31 * annotation type declaration, the declared type may be used on any
32 * program element. If such a meta-annotation is present, the compiler
33 * will enforce the specified usage restriction.
34 *
35 * For example, this meta-annotation indicates that the declared type is
36 * itself a meta-annotation type. It can only be used on annotation type
37 * declarations:
38 * <pre>
39 * &#064;Target(ElementType.ANNOTATION_TYPE)
40 * public &#064;interface MetaAnnotationType {
41 * ...
42 * }
43 * </pre>
44 * This meta-annotation indicates that the declared type is intended solely
45 * for use as a member type in complex annotation type declarations. It
46 * cannot be used to annotate anything directly:
47 * <pre>
48 * &#064;Target({})
49 * public &#064;interface MemberType {
50 * ...
51 * }
52 * </pre>
53 * It is a compile-time error for a single ElementType constant to
54 * appear more than once in a Target annotation. For example, the
55 * following meta-annotation is illegal:
56 * <pre>
57 * &#064;Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
58 * public &#064;interface Bogus {
59 * ...
60 * }
61 * </pre>
62 */
63@Documented
64@Retention(RetentionPolicy.RUNTIME)
65@Target(ElementType.ANNOTATION_TYPE)
66public @interface Target {
67 ElementType[] value();
68}
java/pkg/java/lang/annotation/mkfile+18−0
@@ -0,0 +1,18 @@
1<../../../../../mkconfig
2
3TARG=\
4 Annotation.dis\
5 AnnotationFormatError.dis\
6 AnnotationTypeMismatchException.dis\
7 Documented.dis\
8 ElementType.dis\
9 IncompleteAnnotationException.dis\
10 Inherited.dis\
11 package-info.dis\
12 Retention.dis\
13 RetentionPolicy.dis\
14 Target.dis\
15
16DISBIN=$ROOT/java/dis/java/java/java/lang/annotation
17
18<$ROOT/mkfiles/mkjava
java/pkg/java/lang/annotation/package-info.java+33−0
@@ -0,0 +1,33 @@
1/*
2 * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26/**
27 * Provides library support for the Java programming language
28 * annotation facility.
29 *
30 * @author Josh Bloch
31 * @since 1.5
32 */
33package java.lang.annotation;