001package votorola.g.lang; // Copyright 2009, 2011, Michael Allan. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE. 002 003import java.lang.annotation.*; 004 005 006/** Conveys a warning. The following standard warnings are documented: 007 * 008 * <h3>Dead code</h3> 009 * <pre> 010 * @Warning("dead code")</pre> 011 * 012 * <p>Warns that a particular piece of code is no longer used, or never was used. It 013 * should be tested and possibly modified before use.</p> 014 * 015 * <h3>Init call</h3> 016 * <pre> 017 * @Warning("init call") 018 * // final method</pre> 019 * 020 * <p>Warns that the method is called from a constructor or other initializer where the 021 * call is not dynamically bound. Often the method will have a final modifier to 022 * preclude overriding, even if it happens to be private or implicitly final in the 023 * current revision of the code.</p> 024 * 025 * <h3>Untested</h3> 026 * <pre> 027 * @Warning("untested")</pre> 028 * 029 * <p>Warns that a particular piece of code has never been tested.</p> 030 * 031 * <h3>Non-API</h3> 032 * <pre> 033 * @Warning("non-API") 034 * // non-private member typically</pre> 035 * 036 * <p>Warns that the member is only for internal use. It is not part of the application 037 * programming interface.</p> 038 * 039 * <h3>Thread restricted</h3> 040 * <pre> 041 * @Warning("thread restricted object") 042 * // field, constructor, method 043 * @Warning("thread restricted elements") 044 * // field, constructor, method that dispenses an array 045 * // or collection of elements</pre> 046 * 047 * <p>The first version warns that objects read from the field, or created by the 048 * constructor, or returned by the method are not thread safe. Though the field, 049 * constructor or method may itself be thread safe, the objects it dispenses are not. 050 * The programmer is warned to consult the objects' own type API for the detailed 051 * restrictions. (See also @{@linkplain ThreadRestricted ThreadRestricted}.) The 052 * second version provides the same warning, but with regard to the elements of the 053 * object.</p> 054 * 055 * <pre> 056 * @Warning("thread restricted object, <em>restriction</em>") 057 * // field, constructor, method 058 * @Warning("thread restricted elements, <em>restriction</em>") 059 * // field, constructor, method that dispenses an array 060 * // or collection of elements</pre> 061 * 062 * <p>These are the same as the previous warnings, only they specify the restriction.</p> 063 */ 064 @Documented @Retention(RetentionPolicy.SOURCE) 065 @Target({ ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, 066 ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, 067 ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE }) 068public @interface Warning 069{ 070 071 072 /** The description of the warning, if any. 073 */ 074 public String value(); 075 076 077 078}