001 package edu.rice.cs.cunit.threadCheck.predicates;
002
003 import edu.rice.cs.cunit.threadCheck.PredicateLink;
004 import edu.rice.cs.cunit.threadCheck.Combine;
005
006 import java.lang.annotation.ElementType;
007 import java.lang.annotation.Retention;
008 import java.lang.annotation.RetentionPolicy;
009 import java.lang.annotation.Target;
010
011 /**
012 * An annotation used to designate methods that are not allowed to be run by the thread in the field specified by
013 * class and field name.
014 * @author Mathias Ricken
015 */
016 @Retention(RetentionPolicy.RUNTIME)
017 @Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.TYPE})
018
019 @PredicateLink(value = NotReflectionThreadCheckPredicates.class, method = "checkThread")
020 public @interface NotThreadInField {
021 /**
022 * The class that contains the field specifying the thread that is allowed to run.
023 *
024 * @return class containing the field
025 */
026 Class fieldClass();
027
028 /**
029 * The name of the field specifying the thread that is allowed to run.
030 *
031 * @return name of the field
032 */
033 String fieldName();
034
035 //
036 // nested interfaces
037 //
038
039 /**
040 * An annotation used to designate methods that are not allowed to be run by the thread in the field specified
041 * by class name and field name.
042 */
043 @Retention(RetentionPolicy.RUNTIME)
044 @Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.TYPE})
045
046 @PredicateLink(value = NotReflectionThreadCheckPredicates.class, method = "checkThreadByName")
047 public static @interface ByName {
048 /**
049 * The name of the class that contains the field specifying the thread that is allowed to run.
050 *
051 * @return class containing the field
052 */
053 String fieldClassName();
054
055 /**
056 * The name of the field specifying the thread that is allowed to run.
057 *
058 * @return name of the field
059 */
060 String fieldName();
061
062 //
063 // nested interfaces
064 //
065
066 /**
067 * Annotation used to designate methods that are not allowed to be run by any of the
068 * threads specified in the fields, i.e. the individual
069 * @NotThreadInField.ByName annotations are combined using AND.
070 */
071 @Retention(RetentionPolicy.RUNTIME)
072 @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE})
073
074 @Combine(Combine.Mode.AND)
075 public static @interface None {
076 OnlyThreadInField.ByName[] value();
077 }
078 }
079
080 /**
081 * Annotation used to designate methods that are not allowed to be run by any of the
082 * threads specified in the fields, i.e. the individual
083 * @NotThreadInField annotations are combined using AND.
084 */
085 @Retention(RetentionPolicy.RUNTIME)
086 @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE})
087
088 @Combine(Combine.Mode.AND)
089 public static @interface None {
090 OnlyThreadInField[] value();
091 }
092 }