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. package java.lang;
  8. import java.lang.annotation.*;
  9. import java.lang.annotation.ElementType;
  10. import static java.lang.annotation.ElementType.*;
  11. /**
  12. * Indicates that the named compiler warnings should be suppressed in the
  13. * annotated element (and in all program elements contained in the annotated
  14. * element). Note that the set of warnings suppressed in a given element is
  15. * a superset of the warnings suppressed in all containing elements. For
  16. * example, if you annotate a class to suppress one warning and annotate a
  17. * method to suppress another, both warnings will be suppressed in the method.
  18. *
  19. * <p>As a matter of style, programmers should always use this annotation
  20. * on the most deeply nested element where it is effective. If you want to
  21. * suppress a warning in a particular method, you should annotate that
  22. * method rather than its class.
  23. *
  24. * @since 1.5
  25. * @author Josh Bloch
  26. */
  27. @Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
  28. @Retention(RetentionPolicy.SOURCE)
  29. public @interface SuppressWarnings {
  30. /**
  31. * The set of warnings that are to be suppressed by the compiler in the
  32. * annotated element. Duplicate names are permitted. The second and
  33. * successive occurrences of a name are ignored. The presence of
  34. * unrecognized warning names is <i>not</i> an error: Compilers must
  35. * ignore any warning names they do not recognize. They are, however,
  36. * free to emit a warning if an annotation contains an unrecognized
  37. * warning name.
  38. *
  39. * <p>Compiler vendors should document the warning names they support in
  40. * conjunction with this annotation type. They are encouraged to cooperate
  41. * to ensure that the same names work across multiple compilers.
  42. */
  43. String[] value();
  44. }