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.Retention;
007 import java.lang.annotation.RetentionPolicy;
008 import java.lang.annotation.Target;
009 import java.lang.annotation.ElementType;
010
011 /**
012 * An annotation used to designate methods that are only allowed to be run when the
013 * method argument indexed by value is null.
014 * @author Mathias Ricken
015 */
016 @Retention(RetentionPolicy.RUNTIME)
017 @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE})
018
019 @PredicateLink(value = ThreadCheckPredicates.class, method = "checkNullArgument", arguments = true)
020 public @interface OnlyNullArgument {
021 int value();
022
023 //
024 // nested interfaces
025 //
026
027 /**
028 * Annotation used to designate methods that are only allowed to be run if
029 * one or more of the method arguments are null, i.e. the individual
030 * @OnlyNullArgument annotations are combined using OR.
031 */
032 @Retention(RetentionPolicy.RUNTIME)
033 @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE})
034
035 @Combine(Combine.Mode.OR)
036 public static @interface Any {
037 OnlyNullArgument[] value();
038 }
039
040 /**
041 * Annotation used to designate methods that are only allowed to be run if
042 * all of the method arguments are null, i.e. the individual
043 * @OnlyNullArgument annotations are combined using ALL.
044 */
045 @Retention(RetentionPolicy.RUNTIME)
046 @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE})
047
048 @Combine(Combine.Mode.AND)
049 public static @interface All {
050 OnlyNullArgument[] value();
051 }
052 }