public class NullAnnotationMatching
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
NullAnnotationMatching.CheckMode |
| Modifier and Type | Field and Description |
|---|---|
static NullAnnotationMatching |
NULL_ANNOTATIONS_MISMATCH |
static NullAnnotationMatching |
NULL_ANNOTATIONS_OK |
static NullAnnotationMatching |
NULL_ANNOTATIONS_OK_NONNULL |
static NullAnnotationMatching |
NULL_ANNOTATIONS_UNCHECKED |
int |
nullStatus |
TypeBinding |
superTypeHint
If non-null this field holds the supertype of the provided type which was used for direct matching.
|
| Modifier and Type | Method and Description |
|---|---|
static NullAnnotationMatching |
analyse(TypeBinding requiredType,
TypeBinding providedType,
int nullStatus)
Find any mismatches between the two given types, which are caused by null type annotations.
|
static NullAnnotationMatching |
analyse(TypeBinding requiredType,
TypeBinding providedType,
TypeBinding providedSubstitute,
Substitution substitution,
int nullStatus,
Expression providedExpression,
NullAnnotationMatching.CheckMode mode)
Find any mismatches between the two given types, which are caused by null type annotations.
|
protected static boolean |
areSameTypes(TypeBinding requiredType,
TypeBinding providedType,
TypeBinding providedSubstitute)
Are both types identical wrt the unannotated type and any null type annotations? Only unstructured types and captures are considered.
|
static int |
checkAssignment(BlockScope currentScope,
FlowContext flowContext,
VariableBinding var,
FlowInfo flowInfo,
int nullStatus,
Expression expression,
TypeBinding providedType)
Check null-ness of 'var' against a possible null annotation
|
static MethodBinding |
checkForContradictions(MethodBinding method,
java.lang.Object location,
Scope scope)
After a method has substituted type parameters, check if this resulted in any contradictory null annotations.
|
static boolean |
hasContradictions(TypeBinding type) |
boolean |
isAnyMismatch() |
boolean |
isDefiniteMismatch() |
boolean |
isPotentiallyNullMismatch() |
boolean |
isUnchecked() |
static TypeBinding |
moreDangerousType(TypeBinding one,
TypeBinding two)
Provided that both types are
TypeBinding.equalsEquals(org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding, org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding), return the one that is more likely to show null at runtime. |
static int |
nullStatusFromExpressionType(TypeBinding type)
Use only if no suitable flowInfo is available.
|
static NullAnnotationMatching |
okNonNullStatus(Expression providedExpression) |
void |
report(Scope scope) |
static TypeBinding |
strongerType(TypeBinding type1,
TypeBinding type2,
LookupEnvironment environment) |
java.lang.String |
superTypeHintName(CompilerOptions options,
boolean shortNames) |
java.lang.String |
toString() |
static long |
validNullTagBits(long bits) |
boolean |
wantToReport() |
static TypeBinding[] |
weakerTypes(TypeBinding[] parameters1,
TypeBinding[] parameters2,
LookupEnvironment environment) |
public static final NullAnnotationMatching NULL_ANNOTATIONS_OK
public static final NullAnnotationMatching NULL_ANNOTATIONS_OK_NONNULL
public static final NullAnnotationMatching NULL_ANNOTATIONS_UNCHECKED
public static final NullAnnotationMatching NULL_ANNOTATIONS_MISMATCH
public final TypeBinding superTypeHint
public final int nullStatus
public boolean isAnyMismatch()
public boolean isUnchecked()
public boolean isDefiniteMismatch()
public boolean wantToReport()
public boolean isPotentiallyNullMismatch()
public java.lang.String superTypeHintName(CompilerOptions options, boolean shortNames)
public static int checkAssignment(BlockScope currentScope, FlowContext flowContext, VariableBinding var, FlowInfo flowInfo, int nullStatus, Expression expression, TypeBinding providedType)
public static NullAnnotationMatching analyse(TypeBinding requiredType, TypeBinding providedType, int nullStatus)
requiredType - providedType - nullStatus - we are only interested in NULL or NON_NULL, -1 indicates that we are in a recursion, where flow info is ignoredpublic static NullAnnotationMatching analyse(TypeBinding requiredType, TypeBinding providedType, TypeBinding providedSubstitute, Substitution substitution, int nullStatus, Expression providedExpression, NullAnnotationMatching.CheckMode mode)
requiredType - providedType - providedSubstitute - in inheritance situations this maps the providedType into the realm of the subclass, needed for TVB identity checks.
Pass null if not interested in these added checks.substitution - TODOnullStatus - we are only interested in NULL or NON_NULL, -1 indicates that we are in a recursion, where flow info is ignoredprovidedExpression - optionally holds the provided expression of type 'providedType'mode - controls the kind of check performed (see NullAnnotationMatching.CheckMode).public void report(Scope scope)
public static NullAnnotationMatching okNonNullStatus(Expression providedExpression)
protected static boolean areSameTypes(TypeBinding requiredType, TypeBinding providedType, TypeBinding providedSubstitute)
public static int nullStatusFromExpressionType(TypeBinding type)
public static long validNullTagBits(long bits)
public static TypeBinding moreDangerousType(TypeBinding one, TypeBinding two)
TypeBinding.equalsEquals(org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding, org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding), return the one that is more likely to show null at runtime.public static MethodBinding checkForContradictions(MethodBinding method, java.lang.Object location, Scope scope)
public static boolean hasContradictions(TypeBinding type)
public static TypeBinding strongerType(TypeBinding type1, TypeBinding type2, LookupEnvironment environment)
public static TypeBinding[] weakerTypes(TypeBinding[] parameters1, TypeBinding[] parameters2, LookupEnvironment environment)
public java.lang.String toString()
toString in class java.lang.Object