author | shade |
Tue, 17 May 2016 22:28:00 +0300 | |
changeset 38372 | 017d7578731c |
parent 37304 | c155b23ea178 |
child 41553 | eb5002231dfa |
permissions | -rw-r--r-- |
2 | 1 |
/* |
28305
b29f40cdd33a
6481080: (ann) @Deprecated annotation has no effect on packages
darcy
parents:
25859
diff
changeset
|
2 |
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
package java.lang; |
|
27 |
||
28 |
import java.lang.annotation.*; |
|
4672
ca386fa28a62
6908218: java.lang.Deprecated should have explicit @Target meta-annotation.
darcy
parents:
2
diff
changeset
|
29 |
import static java.lang.annotation.ElementType.*; |
2 | 30 |
|
31 |
/** |
|
37304
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
32 |
* A program element annotated {@code @Deprecated} is one that programmers |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
33 |
* are discouraged from using. An element may be deprecated for any of several |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
34 |
* reasons, for example, its usage is likely to lead to errors; it may |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
35 |
* be changed incompatibly or removed in a future version; it has been |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
36 |
* superseded by a newer, usually preferable alternative; or it is obsolete. |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
37 |
* |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
38 |
* <p>Compilers issue warnings when a deprecated program element is used or |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
39 |
* overridden in non-deprecated code. Use of the {@code @Deprecated} |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
40 |
* annotation on a local variable declaration or on a parameter declaration |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
41 |
* or a package declaration has no effect on the warnings issued by a compiler. |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
42 |
* |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
43 |
* <p>This annotation type has a string-valued element {@code since}. The value |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
44 |
* of this element indicates the version in which the annotated program element |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
45 |
* was first deprecated. |
2 | 46 |
* |
37304
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
47 |
* <p>This annotation type has a boolean-valued element {@code forRemoval}. |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
48 |
* A value of {@code true} indicates intent to remove the annotated program |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
49 |
* element in a future version. A value of {@code false} indicates that use of |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
50 |
* the annotated program element is discouraged, but at the time the program |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
51 |
* element was annotated, there was no specific intent to remove it. |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
52 |
* |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
53 |
* @apiNote |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
54 |
* It is strongly recommended that the reason for deprecating a program element |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
55 |
* be explained in the documentation, using the {@code @deprecated} |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
56 |
* javadoc tag. The documentation should also suggest and link to a |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
57 |
* recommended replacement API, if applicable. A replacement API often |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
58 |
* has subtly different semantics, so such issues should be discussed as |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
59 |
* well. |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
60 |
* |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
61 |
* <p>It is recommended that a {@code since} value be provided with all newly |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
62 |
* annotated program elements. Note that {@code since} cannot be mandatory, |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
63 |
* as there are many existing annotations that lack this element value. |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
64 |
* |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
65 |
* <p>There is no defined order among annotation elements. As a matter of |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
66 |
* style, the {@code since} element should be placed first. |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
67 |
* |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
68 |
* <p>The {@code @Deprecated} annotation should always be present if |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
69 |
* the {@code @deprecated} javadoc tag is present, and vice-versa. |
28305
b29f40cdd33a
6481080: (ann) @Deprecated annotation has no effect on packages
darcy
parents:
25859
diff
changeset
|
70 |
* |
2 | 71 |
* @author Neal Gafter |
72 |
* @since 1.5 |
|
28305
b29f40cdd33a
6481080: (ann) @Deprecated annotation has no effect on packages
darcy
parents:
25859
diff
changeset
|
73 |
* @jls 9.6.4.6 @Deprecated |
2 | 74 |
*/ |
75 |
@Documented |
|
76 |
@Retention(RetentionPolicy.RUNTIME) |
|
4672
ca386fa28a62
6908218: java.lang.Deprecated should have explicit @Target meta-annotation.
darcy
parents:
2
diff
changeset
|
77 |
@Target(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE}) |
2 | 78 |
public @interface Deprecated { |
37304
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
79 |
/** |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
80 |
* Returns the version in which the annotated element became deprecated. |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
81 |
* The version string is in the same format and namespace as the value of |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
82 |
* the {@code @since} javadoc tag. The default value is the empty |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
83 |
* string. |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
84 |
* |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
85 |
* @return the version string |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
86 |
* @since 9 |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
87 |
*/ |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
88 |
String since() default ""; |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
89 |
|
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
90 |
/** |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
91 |
* Indicates whether the annotated element is subject to removal in a |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
92 |
* future version. The default value is {@code false}. |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
93 |
* |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
94 |
* @return whether the element is subject to removal |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
95 |
* @since 9 |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
96 |
*/ |
c155b23ea178
8145461: finalize and integrate @Deprecated annotation specification change
smarks
parents:
33520
diff
changeset
|
97 |
boolean forRemoval() default false; |
2 | 98 |
} |