|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.cunit.threadCheck.subAnnot.SubAnnotThreadCheck
public class SubAnnotThreadCheck
Class that checks whether threads may execute certain classes at runtime.
Nested Class Summary | |
---|---|
static class |
SubAnnotThreadCheck.PredicateViolation
|
static class |
SubAnnotThreadCheck.ReflectionPredicateViolation
|
static class |
SubAnnotThreadCheck.ThreadCheckAnnotationRecord
Storage class for predicate annotations. |
static class |
SubAnnotThreadCheck.Violation
|
Field Summary | |
---|---|
private static long |
_checkCount
Number of checks performed. |
private static java.util.HashSet<java.lang.Thread> |
_inCheckCode
True if the code currently executing is due to thread checking; used to avoid infinite recursions. |
private static java.io.PrintWriter |
_log
PrintWriter with the warning log. |
private static java.io.ObjectOutputStream |
_logData
ObjectOutputStream with the warning log as data. |
private static long |
_violationCount
Number of violationms found. |
static java.lang.String |
DEFAULT_DAT_SUFFIX
Default filename for the data log, if none specified by Java property. |
static java.lang.String |
DEFAULT_LOG_FILENAME
Default filename for the log, if none specified by Java property. |
static java.lang.String |
LOG_FILENAME_PROPERTY
Name of the Java property that determines the log filename. |
Constructor Summary | |
---|---|
SubAnnotThreadCheck()
|
Method Summary | |
---|---|
static void |
checkCurrentThreadReflection(java.lang.Class callerClass,
java.lang.String methodName,
java.lang.String methodDesc,
java.lang.Object thisO,
java.lang.Object[] methodArgs)
Checks if the current thread may execute the method from where this method was called purely using reflection. |
static void |
checkForSubtypingClassWarnings(ClassEx cf,
MethodEx mi,
ClassEx scf,
SubAnnotThreadCheck.ThreadCheckAnnotationRecord classAR,
SubAnnotThreadCheck.ThreadCheckAnnotationRecord superClassAR)
Check for subtyping warnings. |
static boolean |
checkInvariantAnnotation(InvariantAnnotation value,
java.lang.Object thisObject,
java.lang.Object[] methodArgs)
Convenience method to get the result of an invariant annotation check. |
static java.lang.Boolean |
checkPredicateLinkAnnotation(java.lang.annotation.Annotation ann,
PredicateLink pl,
java.lang.Object thisO,
java.lang.Object[] methodArgs)
Handle a @PredicateLink-style annotation. |
static void |
flushLog()
Flush the log. |
static java.lang.String |
form(java.lang.String word,
long count)
Return the correct form, singular or plural, of the word, depending on the count. |
static SubAnnotThreadCheck.ThreadCheckAnnotationRecord |
getClassAnnotations(ClassEx cf)
Get the annotations for the specified class file. |
static SubAnnotThreadCheck.ThreadCheckAnnotationRecord |
getMethodAnnotations(ClassEx cf,
MethodEx mi)
Get the annotations for the specified method in the specified class file. |
static java.lang.String |
getMethodDescriptor(MethodEx m)
Return the method descriptor for the method. |
static MethodEx |
getMethodWithNameAndDescriptor(ClassEx methodClass,
java.lang.String methodName,
java.lang.String methodDesc)
Return the method with the specified name and descriptor. |
static SubAnnotThreadCheck.ThreadCheckAnnotationRecord |
getPredicateSets(java.lang.annotation.Annotation[] annotations)
Get the predicate sets from the array of annotations. |
static void |
initLog()
Initialize the error log. |
static void |
log(java.lang.String s)
Log to the log file. |
static void |
writeLog(SubAnnotThreadCheck.Violation v)
Write to the error log, and potentially initialize it first. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LOG_FILENAME_PROPERTY
public static final java.lang.String DEFAULT_LOG_FILENAME
public static final java.lang.String DEFAULT_DAT_SUFFIX
private static volatile java.util.HashSet<java.lang.Thread> _inCheckCode
private static volatile java.io.PrintWriter _log
private static volatile java.io.ObjectOutputStream _logData
private static volatile long _checkCount
private static volatile long _violationCount
Constructor Detail |
---|
public SubAnnotThreadCheck()
Method Detail |
---|
public static void writeLog(SubAnnotThreadCheck.Violation v)
v
- violation to logpublic static void initLog()
public static void log(java.lang.String s)
s
- stringpublic static void flushLog()
public static void checkCurrentThreadReflection(java.lang.Class callerClass, java.lang.String methodName, java.lang.String methodDesc, java.lang.Object thisO, java.lang.Object[] methodArgs)
callerClass
- class of the callermethodName
- name of the methodmethodDesc
- descriptor of the methodthisO
- value of this, or null in a static contextmethodArgs
- array of method arguments, or null if none passedpublic static boolean checkInvariantAnnotation(InvariantAnnotation value, java.lang.Object thisObject, java.lang.Object[] methodArgs)
value
- the invariant annotationthisObject
- value of this, or null if staticmethodArgs
- array of method arguments
public static java.lang.Boolean checkPredicateLinkAnnotation(java.lang.annotation.Annotation ann, PredicateLink pl, java.lang.Object thisO, java.lang.Object[] methodArgs)
ann
- annotationpl
- associated @PredicateLinkthisO
- value of this, or null
public static MethodEx getMethodWithNameAndDescriptor(ClassEx methodClass, java.lang.String methodName, java.lang.String methodDesc)
methodClass
- classmethodName
- namemethodDesc
- descriptor
public static java.lang.String getMethodDescriptor(MethodEx m)
m
- method
public static java.lang.String form(java.lang.String word, long count)
word
- wordcount
- count
public static SubAnnotThreadCheck.ThreadCheckAnnotationRecord getMethodAnnotations(ClassEx cf, MethodEx mi)
cf
- class filemi
- method information
public static SubAnnotThreadCheck.ThreadCheckAnnotationRecord getClassAnnotations(ClassEx cf)
cf
- class file
public static SubAnnotThreadCheck.ThreadCheckAnnotationRecord getPredicateSets(java.lang.annotation.Annotation[] annotations)
annotations
- array of annotations
public static void checkForSubtypingClassWarnings(ClassEx cf, MethodEx mi, ClassEx scf, SubAnnotThreadCheck.ThreadCheckAnnotationRecord classAR, SubAnnotThreadCheck.ThreadCheckAnnotationRecord superClassAR)
cf
- class filemi
- method information, or null if on class levelscf
- superclass/interface class fileclassAR
- subclass annotationssuperClassAR
- superclass annotations
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |