edu.umd.cs.findbugs.ba.npe
Class NonNullContractCollector

java.lang.Object
  extended by edu.umd.cs.findbugs.ba.npe.NonNullContractCollector
All Implemented Interfaces:
JavaClassAndMethodChooser

public class NonNullContractCollector
extends java.lang.Object
implements JavaClassAndMethodChooser

Find the contract specified by @NonNull and @CheckForNull parameter annotations in the class hierarchy. Also, check null argument sets for violations.

TODO: this code could be generalized for other kinds of parameter annotations

Author:
David Hovemeyer

Nested Class Summary
static interface NonNullContractCollector.SpecificationBuilder
           
 
Constructor Summary
NonNullContractCollector(ParameterNullnessPropertyDatabase nonNullParamDatabase, ParameterNullnessPropertyDatabase possiblyNullParamDatabase)
           
 
Method Summary
 void checkSpecifications(int numParams, NonNullContractCollector.SpecificationBuilder builder)
           
 boolean choose(JavaClassAndMethod classAndMethod)
           
 void findContractForCallSite(org.apache.bcel.generic.InvokeInstruction invokeInstruction, org.apache.bcel.generic.ConstantPoolGen cpg)
           
 void findContractForMethod(JavaClassAndMethod classAndMethod)
           
 void getAnnotationSets(int numParams, java.util.BitSet nonNullParamSet, java.util.BitSet possiblyNullParamSet)
           
 void getViolationList(int numParams, java.util.BitSet nullArgSet, java.util.List<NonNullParamViolation> violationList, java.util.BitSet violatedParamSet)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonNullContractCollector

public NonNullContractCollector(ParameterNullnessPropertyDatabase nonNullParamDatabase,
                                ParameterNullnessPropertyDatabase possiblyNullParamDatabase)
Method Detail

choose

public boolean choose(JavaClassAndMethod classAndMethod)
Specified by:
choose in interface JavaClassAndMethodChooser

findContractForCallSite

public void findContractForCallSite(org.apache.bcel.generic.InvokeInstruction invokeInstruction,
                                    org.apache.bcel.generic.ConstantPoolGen cpg)
                             throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

findContractForMethod

public void findContractForMethod(JavaClassAndMethod classAndMethod)
                           throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

checkSpecifications

public void checkSpecifications(int numParams,
                                NonNullContractCollector.SpecificationBuilder builder)

getViolationList

public void getViolationList(int numParams,
                             java.util.BitSet nullArgSet,
                             java.util.List<NonNullParamViolation> violationList,
                             java.util.BitSet violatedParamSet)

getAnnotationSets

public void getAnnotationSets(int numParams,
                              java.util.BitSet nonNullParamSet,
                              java.util.BitSet possiblyNullParamSet)