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 |
int |
severity
0 = OK, 1 = unchecked, 2 = definite mismatch
|
TypeBinding |
superTypeHint
If non-null this field holds the supertype of the provided type which was used for direct matching.
|
| Constructor and Description |
|---|
NullAnnotationMatching(int severity,
int nullStatus,
TypeBinding superTypeHint) |
| 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,
int nullStatus,
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 TypeBinding |
strongerType(TypeBinding type1,
TypeBinding type2,
LookupEnvironment environment) |
java.lang.String |
superTypeHintName(CompilerOptions options,
boolean shortNames) |
static long |
validNullTagBits(long bits) |
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 int severity
public final TypeBinding superTypeHint
public final int nullStatus
public NullAnnotationMatching(int severity,
int nullStatus,
TypeBinding superTypeHint)
public boolean isAnyMismatch()
public boolean isUnchecked()
public boolean isDefiniteMismatch()
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, int nullStatus, 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.nullStatus - we are only interested in NULL or NON_NULL, -1 indicates that we are in a recursion, where flow info is ignoredmode - controls the kind of check performed (see NullAnnotationMatching.CheckMode).protected static boolean areSameTypes(TypeBinding requiredType, TypeBinding providedType, TypeBinding providedSubstitute)
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)