package waymaker.gen; // Copyright © 2009 Michael Allan. Licence MIT. import java.lang.annotation.*; /** Conveys one or more warnings. The following specific warnings are documented: * *
* @Warning("co-extant co-construct") * // on constructor or factory method* *
Warns not to discard the construct and create a replacement during the life of the named * co-extant, because currently the construct does not unregister its callbacks from the co-extant, nor * otherwise clean up after itself. A further search in the source code for ‘co-construct’ should * reveal the exact cause.
* ** @Warning("unused code")* *
Informs that the code is not in actual use.
* ** @Warning("init call") * // on final method of non-final class* *
Warns that the method is called from a constructor or other initializer where the call cannot be * bound dynamically. In addition to the warning, the method should also have a final modifier to * explicitly bar overriding, even if it happens to be private in the current revision of the code.
* ** @Warning("no hold") * // on class* *
Warns not to indefinitely hold an instance. A further search in the source code for “no hold” * should reveal the reason.
* ** @Warning("non-API") * // on public member* *
Warns that the member is not part of the general application programming interface. It’s not for * ordinary programming purposes. Rather it’s an implementation detail that couldn’t easily be hidden, * or a temporary test tool, or some other special-purpose code.
* ** @Warning("thread restricted object") * // on field, constructor, method * @Warning("thread restricted elements") * // on field, constructor, method that dispenses an array * // or collection of elements* *
The first version warns that objects read from the field, or created by the constructor, or * returned by the method are not thread safe. Though the field, constructor or method itself may be * thread safe, the objects it dispenses are not. The programmer is warned to consult the objects’ own * type API for the detailed restrictions. (See also @{@linkplain ThreadRestricted * ThreadRestricted}.) The second version provides the same warning, but with regard to the elements * of the object.
* ** @Warning("thread restricted object, restriction") * // on field, constructor, method * @Warning("thread restricted elements, restriction") * // on field, constructor, method that dispenses an array * // or collection of elements* *
These are like the previous warnings, except they specify the restriction.
* ** @Warning("untested")* *
Warns that a particular piece of code has never been tested.
*/ @Documented @Retention(RetentionPolicy.SOURCE) @Target({ ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE }) public @interface Warning { /** The literal form of the warnings, one for each. */ public String[] value(); }