151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski/* 24e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. 351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * This code is free software; you can redistribute it and/or modify it 651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * under the terms of the GNU General Public License version 2 only, as 751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * published by the Free Software Foundation. Oracle designates this 851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * particular file as subject to the "Classpath" exception as provided 951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * by Oracle in the LICENSE file that accompanied this code. 1051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 1151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * This code is distributed in the hope that it will be useful, but WITHOUT 1251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * version 2 for more details (a copy is included in the LICENSE file that 1551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * accompanied this code). 1651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 1751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * You should have received a copy of the GNU General Public License version 1851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 2 along with this work; if not, write to the Free Software Foundation, 1951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 2151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or visit www.oracle.com if you need additional information or have any 2351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * questions. 2451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 2551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 2651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebskipackage java.lang; 2751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 2851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebskiimport java.lang.annotation.*; 2951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebskiimport static java.lang.annotation.ElementType.*; 3051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 3151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski/** 3251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Indicates that the named compiler warnings should be suppressed in the 3351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * annotated element (and in all program elements contained in the annotated 3451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * element). Note that the set of warnings suppressed in a given element is 3551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * a superset of the warnings suppressed in all containing elements. For 3651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * example, if you annotate a class to suppress one warning and annotate a 3751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * method to suppress another, both warnings will be suppressed in the method. 3851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 3951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <p>As a matter of style, programmers should always use this annotation 4051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * on the most deeply nested element where it is effective. If you want to 4151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * suppress a warning in a particular method, you should annotate that 4251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * method rather than its class. 4351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 4451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @author Josh Bloch 454e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * @since 1.5 464e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * @jls 4.8 Raw Types 474e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * @jls 4.12.2 Variables of Reference Type 484e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * @jls 5.1.9 Unchecked Conversion 494e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * @jls 5.5.2 Checked Casts and Unchecked Casts 504e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * @jls 9.6.3.5 @SuppressWarnings 5151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 5251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE}) 5351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski@Retention(RetentionPolicy.SOURCE) 5451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebskipublic @interface SuppressWarnings { 5551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 5651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * The set of warnings that are to be suppressed by the compiler in the 5751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * annotated element. Duplicate names are permitted. The second and 5851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * successive occurrences of a name are ignored. The presence of 5951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * unrecognized warning names is <i>not</i> an error: Compilers must 6051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * ignore any warning names they do not recognize. They are, however, 6151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * free to emit a warning if an annotation contains an unrecognized 6251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * warning name. 6351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 644e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * <p> The string {@code "unchecked"} is used to suppress 654e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * unchecked warnings. Compiler vendors should document the 664e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * additional warning names they support in conjunction with this 674e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * annotation type. They are encouraged to cooperate to ensure 684e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * that the same names work across multiple compilers. 694e73fd2bc22e704fe71465782b83be0471ac5e82Przemyslaw Szczepaniak * @return the set of warnings to be suppressed 7051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 7151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski String[] value(); 7251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski} 73