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 when the
014 * monitor of the method argument indexed by value is owned by any thread.
015 * @author Mathias Ricken
016 */
017 @Retention(RetentionPolicy.RUNTIME)
018 @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE})
019
020 @PredicateLink(value = Predicates.class, method = "checkSynchronizedArgument", arguments = true)
021 public @interface SynchronizedArgument extends InvariantAnnotation {
022 /**
023 * Index of the argument whose monitor needs to be owned by the current thread.
024 * @return index of the argument
025 */
026 public int value();
027 }