KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > lang > SuppressWarnings


1 /*
2  * @(#)SuppressWarnings.java 1.3 04/02/06
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.lang;
9
10 import java.lang.annotation.*;
11 import java.lang.annotation.ElementType JavaDoc;
12 import static java.lang.annotation.ElementType JavaDoc.*;
13
14 /**
15  * Indicates that the named compiler warnings should be suppressed in the
16  * annotated element (and in all program elements contained in the annotated
17  * element). Note that the set of warnings suppressed in a given element is
18  * a superset of the warnings suppressed in all containing elements. For
19  * example, if you annotate a class to suppress one warning and annotate a
20  * method to suppress another, both warnings will be suppressed in the method.
21  *
22  * <p>As a matter of style, programmers should always use this annotation
23  * on the most deeply nested element where it is effective. If you want to
24  * suppress a warning in a particular method, you should annotate that
25  * method rather than its class.
26  *
27  * @since 1.5
28  * @author Josh Bloch
29  */

30 @Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
31 @Retention(RetentionPolicy.SOURCE)
32 public @interface SuppressWarnings {
33     /**
34      * The set of warnings that are to be suppressed by the compiler in the
35      * annotated element. Duplicate names are permitted. The second and
36      * successive occurrences of a name are ignored. The presence of
37      * unrecognized warning names is <i>not</i> an error: Compilers must
38      * ignore any warning names they do not recognize. They are, however,
39      * free to emit a warning if an annotation contains an unrecognized
40      * warning name.
41      *
42      * <p>Compiler vendors should document the warning names they support in
43      * conjunction with this annotation type. They are encouraged to cooperate
44      * to ensure that the same names work across multiple compilers.
45      */

46     String JavaDoc[] value();
47 }
48
Popular Tags