001 package edu.rice.cs.cunit.threadCheck.subAnnot.predicates;
002
003 import edu.rice.cs.cunit.threadCheck.subAnnot.PredicateLink;
004 import edu.rice.cs.cunit.threadCheck.subAnnot.Predicates;
005 import edu.rice.cs.cunit.threadCheck.subAnnot.InvariantAnnotation;
006
007 import java.lang.annotation.ElementType;
008 import java.lang.annotation.Retention;
009 import java.lang.annotation.RetentionPolicy;
010 import java.lang.annotation.Target;
011
012 /**
013 * An annotation used to designate methods that are only allowed to be run by the thread in the field specified by
014 * class and field name.
015 *
016 * @author Mathias Ricken
017 */
018 @Retention(RetentionPolicy.RUNTIME)
019 @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE})
020
021 @PredicateLink(value = Predicates.class, method = "checkThread")
022 public @interface ThreadInField extends InvariantAnnotation {
023 /**
024 * The class that contains the field specifying the thread that is allowed to run.
025 *
026 * @return class containing the field
027 */
028 Class fieldClass();
029
030 /**
031 * The name of the field specifying the thread that is allowed to run.
032 *
033 * @return name of the field
034 */
035 String fieldName();
036
037 //
038 // nested interfaces
039 //
040
041 /**
042 * An annotation used to designate methods that are only allowed to be run by the thread in the field specified
043 * by class name and field name.
044 *
045 * @author Mathias Ricken
046 */
047 @Retention(RetentionPolicy.RUNTIME)
048 @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE})
049
050 @PredicateLink(value = Predicates.class, method = "checkThreadByName")
051 public @interface ByName extends InvariantAnnotation {
052 /**
053 * The name of the class that contains the field specifying the thread that is allowed to run.
054 *
055 * @return class containing the field
056 */
057 String fieldClassName();
058
059 /**
060 * The name of the field specifying the thread that is allowed to run.
061 *
062 * @return name of the field
063 */
064 String fieldName();
065 }
066 }