|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.findbugs.detect.FindInconsistentSync2
public class FindInconsistentSync2
Nested Class Summary | |
---|---|
private static class |
FindInconsistentSync2.FieldStats
The access statistics for a field. |
Field Summary | |
---|---|
private static boolean |
ADJUST_SUBCLASS_ACCESSES
|
private BugReporter |
bugReporter
|
private static boolean |
DEBUG
|
private static boolean |
EVAL
|
private static int |
LOCKED
|
private static int |
MIN_SYNC_PERCENT
Minimum percent of unbiased field accesses that must be synchronized in order to report a field as inconsistently synchronized. |
private static int |
READ
|
private static int |
READ_LOCKED
|
private static int |
READ_UNLOCKED
|
private java.util.Map<XField,FindInconsistentSync2.FieldStats> |
statMap
|
private static boolean |
SYNC_ACCESS
|
private static int |
UNLOCKED
|
private static double |
UNSYNC_FACTOR
Factor which the biased number of unsynchronized accesses is multiplied by. |
private static int |
WRITE
|
private static double |
WRITE_BIAS
Bias that writes are given with respect to reads. |
private static int |
WRITE_LOCKED
|
private static int |
WRITE_UNLOCKED
|
Fields inherited from interface edu.umd.cs.findbugs.Detector |
---|
EXP_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY |
Constructor Summary | |
---|---|
FindInconsistentSync2(BugReporter bugReporter)
|
Method Summary | |
---|---|
private void |
analyzeMethod(ClassContext classContext,
org.apache.bcel.classfile.Method method,
java.util.Set<org.apache.bcel.classfile.Method> lockedMethodSet)
|
private java.util.Set<org.apache.bcel.classfile.Method> |
findLockedMethods(ClassContext classContext,
SelfCalls selfCalls,
java.util.Set<CallSite> obviouslyLockedSites)
Find methods that appear to always be called from a locked context. |
private java.util.Set<org.apache.bcel.classfile.Method> |
findNotUnlockedMethods(ClassContext classContext,
SelfCalls selfCalls,
java.util.Set<CallSite> obviouslyLockedSites)
Find methods that appear to never be called from an unlocked context We assume that nonpublic methods will only be called from within the class, which is not really a valid assumption. |
private java.util.Set<CallSite> |
findObviouslyLockedCallSites(ClassContext classContext,
SelfCalls selfCalls)
Find all self-call sites that are obviously locked. |
private java.util.Set<org.apache.bcel.classfile.Method> |
findPublicReachableMethods(ClassContext classContext,
SelfCalls selfCalls)
Find methods that do not appear to be reachable from public methods. |
private FindInconsistentSync2.FieldStats |
getStats(XField field)
Get the access statistics for given field. |
private static boolean |
isConstructor(java.lang.String methodName)
|
static boolean |
isGetterMethod(ClassContext classContext,
org.apache.bcel.classfile.Method method)
Determine whether or not the the given method is a getter method. |
void |
report()
This method is called after all classes to be visited. |
void |
setAnalysisContext(AnalysisContext analysisContext)
Set the AnalysisContext that will be used. |
void |
visitClassContext(ClassContext classContext)
Visit the ClassContext for a class which should be analyzed for instances of bug patterns. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private static final boolean SYNC_ACCESS
private static final boolean ADJUST_SUBCLASS_ACCESSES
private static final boolean EVAL
private static final int MIN_SYNC_PERCENT
private static final double WRITE_BIAS
private static final double UNSYNC_FACTOR
f(nUnsync) > nSyncthen we report a bug. Default value is 2.0, which means that we report a bug if more than 1/3 of accesses are unsynchronized.
Note that MIN_SYNC_PERCENT
also influences
whether we report a bug: it specifies the minimum unbiased percentage
of synchronized accesses.
private static final int UNLOCKED
private static final int LOCKED
private static final int READ
private static final int WRITE
private static final int READ_UNLOCKED
private static final int WRITE_UNLOCKED
private static final int READ_LOCKED
private static final int WRITE_LOCKED
private BugReporter bugReporter
private java.util.Map<XField,FindInconsistentSync2.FieldStats> statMap
Constructor Detail |
---|
public FindInconsistentSync2(BugReporter bugReporter)
Method Detail |
---|
public void setAnalysisContext(AnalysisContext analysisContext)
Detector
setAnalysisContext
in interface Detector
analysisContext
- the AnalysisContextpublic void visitClassContext(ClassContext classContext)
Detector
visitClassContext
in interface Detector
classContext
- the ClassContextpublic void report()
Detector
report
in interface Detector
private static boolean isConstructor(java.lang.String methodName)
private void analyzeMethod(ClassContext classContext, org.apache.bcel.classfile.Method method, java.util.Set<org.apache.bcel.classfile.Method> lockedMethodSet) throws CFGBuilderException, DataflowAnalysisException
CFGBuilderException
DataflowAnalysisException
public static boolean isGetterMethod(ClassContext classContext, org.apache.bcel.classfile.Method method)
classContext
- the ClassContext for the class containing the methodmethod
- the methodprivate FindInconsistentSync2.FieldStats getStats(XField field)
private java.util.Set<org.apache.bcel.classfile.Method> findNotUnlockedMethods(ClassContext classContext, SelfCalls selfCalls, java.util.Set<CallSite> obviouslyLockedSites) throws CFGBuilderException, DataflowAnalysisException
CFGBuilderException
DataflowAnalysisException
private java.util.Set<org.apache.bcel.classfile.Method> findLockedMethods(ClassContext classContext, SelfCalls selfCalls, java.util.Set<CallSite> obviouslyLockedSites) throws CFGBuilderException, DataflowAnalysisException
CFGBuilderException
DataflowAnalysisException
private java.util.Set<org.apache.bcel.classfile.Method> findPublicReachableMethods(ClassContext classContext, SelfCalls selfCalls) throws CFGBuilderException, DataflowAnalysisException
CFGBuilderException
DataflowAnalysisException
private java.util.Set<CallSite> findObviouslyLockedCallSites(ClassContext classContext, SelfCalls selfCalls) throws CFGBuilderException, DataflowAnalysisException
CFGBuilderException
DataflowAnalysisException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |