001package typequals.prototype.qual; 002 003import java.lang.annotation.ElementType; 004import java.lang.annotation.Target; 005import org.checkerframework.framework.qual.SubtypeOf; 006 007/** 008 * The Prototype and NonPrototype qualifiers apply only to Invariant (and its subclasses). A 009 * prototype invariant is one that is not instantiated over a particular set of variables, will 010 * never be applied to values, etc. A prototype can have any operation performed on it that does not 011 * depend on properties of instance fields, and the prototype's {@link daikon.inv.Invariant#ppt} 012 * field is null. Prototypes are often used as factory objects from which to instantiate 013 * non-prototypes, but can be used for other purposes as well. 014 * 015 * <p>The {@code Prototype} qualifier means an invariant that is <em>either</em> a prototype or not. 016 * There is not a way to say that a particular reference is definitely a prototype. A method that 017 * can be called on a prototype does not access instance fields. It cannot be a static method for 018 * two reasons: 019 * 020 * <ul> 021 * <li>The method does access the {@code swap} field in some classes. This is a design flaw; the 022 * classes that currently use a {@code swap} field should probably be rewritten to be two 023 * distinct classes. (Currently, some of Daikon's invariants use the {@code swap} field 024 * approach and some use the approach of multiple classes. Making the codebase uniform would 025 * be another benefit.) 026 * <li>Static method cannot override one another, so the methods need to be instance methods 027 * regardless. 028 * </ul> 029 */ 030@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 031@SubtypeOf({}) 032public @interface Prototype {}