Package edu.umd.cs.findbugs.ba.npe
Class TypeQualifierNullnessAnnotationDatabase
java.lang.Object
edu.umd.cs.findbugs.ba.npe.TypeQualifierNullnessAnnotationDatabase
- All Implemented Interfaces:
INullnessAnnotationDatabase
public class TypeQualifierNullnessAnnotationDatabase
extends Object
implements INullnessAnnotationDatabase
Implementation of INullnessAnnotationDatabase that is based on JSR-305 type
qualifiers.
- Author:
- David Hovemeyer
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a default annotation to the database.void
addFieldAnnotation
(String cName, String mName, String mSig, boolean isStatic, NullnessAnnotation annotation) Add a field annotation to the database.void
addMethodAnnotation
(String cName, String mName, String sig, boolean isStatic, NullnessAnnotation annotation) Add a method annotation to the database.void
addMethodParameterAnnotation
(String cName, String mName, String sig, boolean isStatic, int param, NullnessAnnotation annotation) Add a method parameter annotation to the database.static boolean
getInheritedAnnotation
(XMethod m, int parameter) getResolvedAnnotation
(Object o, boolean getMinimal) Get a resolved NullnessAnnotation on given XMethod, XField, or XMethodParameter.getXMethod
(String cName, String mName, String sig, boolean isStatic) void
Load "built-in" annotations that might not be evident from the analyzed/referenced code.boolean
parameterMustBeNonNull
(XMethod m, int param) Determine whether given parameter must be non-null.
-
Field Details
-
nonnullTypeQualifierValue
-
-
Constructor Details
-
TypeQualifierNullnessAnnotationDatabase
public TypeQualifierNullnessAnnotationDatabase()
-
-
Method Details
-
getResolvedAnnotation
Description copied from interface:INullnessAnnotationDatabase
Get a resolved NullnessAnnotation on given XMethod, XField, or XMethodParameter.- Specified by:
getResolvedAnnotation
in interfaceINullnessAnnotationDatabase
- Parameters:
o
- an XMethod, XField, or XMethodParametergetMinimal
- TODO: what does this mean?- Returns:
- resolved NullnessAnnotation
-
getInheritedAnnotation
-
getInheritedAnnotation
-
getDirectAnnotation
-
assertsFirstParameterIsNonnull
-
parameterMustBeNonNull
Description copied from interface:INullnessAnnotationDatabase
Determine whether given parameter must be non-null.- Specified by:
parameterMustBeNonNull
in interfaceINullnessAnnotationDatabase
- Parameters:
m
- a methodparam
- parameter (0 == first parameter)- Returns:
- true if the parameter must be non-null, false otherwise
-
addDefaultAnnotation
Description copied from interface:INullnessAnnotationDatabase
Add a default annotation to the database.- Specified by:
addDefaultAnnotation
in interfaceINullnessAnnotationDatabase
- Parameters:
target
- one of AnnotationDatabase.METHOD, AnnotationDatabase.FIELD, AnnotationDatabase.PARAMETER, or AnnotationDatabase.ANYc
- dotted class name of class default annotation pertains ton
- the default NullnessAnnotation
-
addFieldAnnotation
public void addFieldAnnotation(String cName, String mName, String mSig, boolean isStatic, NullnessAnnotation annotation) Description copied from interface:INullnessAnnotationDatabase
Add a field annotation to the database.- Specified by:
addFieldAnnotation
in interfaceINullnessAnnotationDatabase
- Parameters:
cName
- dotted class namemName
- field namemSig
- field signatureisStatic
- true if field is static, false otherwiseannotation
- NullnessAnnotation to add
-
getXMethod
-
addMethodAnnotation
public void addMethodAnnotation(String cName, String mName, String sig, boolean isStatic, NullnessAnnotation annotation) Description copied from interface:INullnessAnnotationDatabase
Add a method annotation to the database.- Specified by:
addMethodAnnotation
in interfaceINullnessAnnotationDatabase
- Parameters:
cName
- dotted class namemName
- method namesig
- method signatureisStatic
- true if method is static, false otherwiseannotation
- NullnessAnnotation to add
-
addMethodParameterAnnotation
public void addMethodParameterAnnotation(@DottedClassName String cName, String mName, String sig, boolean isStatic, int param, NullnessAnnotation annotation) Description copied from interface:INullnessAnnotationDatabase
Add a method parameter annotation to the database.- Specified by:
addMethodParameterAnnotation
in interfaceINullnessAnnotationDatabase
- Parameters:
cName
- dotted class namemName
- method namesig
- method signatureisStatic
- true if method is static, false otherwiseparam
- parameter (0 == first parameter)annotation
- the NullnessAnnotation to add
-
loadAuxiliaryAnnotations
public void loadAuxiliaryAnnotations()Description copied from interface:INullnessAnnotationDatabase
Load "built-in" annotations that might not be evident from the analyzed/referenced code.- Specified by:
loadAuxiliaryAnnotations
in interfaceINullnessAnnotationDatabase
-