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 not allowed to own the monitor of the field specified by 013 * class and field name. 014 * 015 * @author Mathias Ricken 016 */ 017 @Retention(RetentionPolicy.RUNTIME) 018 @Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.TYPE}) 019 020 @PredicateLink(value = NotReflectionThreadCheckPredicates.class, method = "checkSynchronizedField") 021 public @interface NotSynchronizedField { 022 /** 023 * The class that contains the field whose monitor the thread may not own. 024 * 025 * @return class containing the field 026 */ 027 Class fieldClass(); 028 029 /** 030 * The name of the field whose monitor the thread may not own. 031 * 032 * @return name of the field 033 */ 034 String fieldName(); 035 036 // 037 // nested interfaces 038 // 039 040 /** 041 * An annotation used to designate methods that are not allowed to own the monitor of the field specified 042 * by class name and field name. 043 */ 044 @Retention(RetentionPolicy.RUNTIME) 045 @Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.TYPE}) 046 047 @PredicateLink(value = NotReflectionThreadCheckPredicates.class, method = "checkSynchronizedFieldByName") 048 public static @interface ByName { 049 /** 050 * The name of the class that contains the field whose monitor the thread may not own. 051 * 052 * @return class containing the field 053 */ 054 String fieldClassName(); 055 056 /** 057 * The name of the field whose monitor the thread may not own. 058 * 059 * @return name of the field 060 */ 061 String fieldName(); 062 063 // 064 // nested interfaces 065 // 066 067 /** 068 * Annotation used to designate methods that are not allowed to be own any of the monitors 069 * of the fields specified, i.e. the individual @NotSynchronizedField.ByName annotations are 070 * combined using AND. 071 */ 072 @Retention(RetentionPolicy.RUNTIME) 073 @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE}) 074 075 @Combine(Combine.Mode.AND) 076 public static @interface None { 077 NotSynchronizedField.ByName[] value(); 078 } 079 } 080 081 /** 082 * Annotation used to designate methods that are not allowed to be own any of the monitors 083 * of the fields specified, i.e. the individual @NotSynchronizedField.ByName annotations are 084 * combined using AND. 085 */ 086 @Retention(RetentionPolicy.RUNTIME) 087 @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE}) 088 089 @Combine(Combine.Mode.AND) 090 public static @interface None { 091 NotSynchronizedField[] value(); 092 } 093 }