Klasse NullAnnotationMatching
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.ast.NullAnnotationMatching
Performs matching of null type annotations.
Instances are used to encode result from this analysis.
- Seit:
- 3.10
-
Verschachtelte Klassen - Übersicht
-
Feldübersicht
Modifizierer und TypFeldBeschreibungstatic final NullAnnotationMatching
static final NullAnnotationMatching
static final NullAnnotationMatching
static final NullAnnotationMatching
final int
final TypeBinding
If non-null this field holds the supertype of the provided type which was used for direct matching. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic 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?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 annotationstatic MethodBinding
checkForContradictions
(MethodBinding method, 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
boolean
boolean
boolean
boolean
static TypeBinding
moreDangerousType
(TypeBinding one, TypeBinding two) Provided that both types areTypeBinding.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
Use only if no suitable flowInfo is available.static NullAnnotationMatching
okNonNullStatus
(Expression providedExpression) void
static TypeBinding
strongerType
(TypeBinding type1, TypeBinding type2, LookupEnvironment environment) superTypeHintName
(CompilerOptions options, boolean shortNames) toString()
static long
validNullTagBits
(long bits) boolean
static TypeBinding[]
weakerTypes
(TypeBinding[] parameters1, TypeBinding[] parameters2, LookupEnvironment environment) withNullStatus
(int updatedNullStatus) For creating updated status during *FlowContext.complainOnDeferred*Checks() once the actual nullStatus is known
-
Felddetails
-
NULL_ANNOTATIONS_OK
-
NULL_ANNOTATIONS_OK_NONNULL
-
NULL_ANNOTATIONS_UNCHECKED
-
NULL_ANNOTATIONS_MISMATCH
-
superTypeHint
If non-null this field holds the supertype of the provided type which was used for direct matching. -
nullStatus
public final int nullStatus
-
-
Methodendetails
-
withNullStatus
For creating updated status during *FlowContext.complainOnDeferred*Checks() once the actual nullStatus is known -
isAnyMismatch
public boolean isAnyMismatch() -
isUnchecked
public boolean isUnchecked() -
isAnnotatedToUnannotated
public boolean isAnnotatedToUnannotated() -
isDefiniteMismatch
public boolean isDefiniteMismatch() -
wantToReport
public boolean wantToReport() -
isPotentiallyNullMismatch
public boolean isPotentiallyNullMismatch() -
superTypeHintName
-
checkAssignment
public 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 -
analyse
public static NullAnnotationMatching analyse(TypeBinding requiredType, TypeBinding providedType, int nullStatus) Find any mismatches between the two given types, which are caused by null type annotations.- Parameter:
requiredType
-providedType
-nullStatus
- we are only interested in NULL or NON_NULL, -1 indicates that we are in a recursion, where flow info is ignored- Gibt zurück:
- a status object representing the severity of mismatching plus optionally a supertype hint
-
analyse
public 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.- Parameter:
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 (seeNullAnnotationMatching.CheckMode
).- Gibt zurück:
- a status object representing the severity of mismatching plus optionally a supertype hint
-
report
-
okNonNullStatus
-
areSameTypes
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. -
nullStatusFromExpressionType
Use only if no suitable flowInfo is available. -
validNullTagBits
public static long validNullTagBits(long bits) -
moreDangerousType
Provided that both types areTypeBinding.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. -
checkForContradictions
public static MethodBinding checkForContradictions(MethodBinding method, Object location, Scope scope) After a method has substituted type parameters, check if this resulted in any contradictory null annotations. Problems are either reported directly (if scope != null) or by returning a ProblemMethodBinding. -
hasContradictions
-
strongerType
public static TypeBinding strongerType(TypeBinding type1, TypeBinding type2, LookupEnvironment environment) -
weakerTypes
public static TypeBinding[] weakerTypes(TypeBinding[] parameters1, TypeBinding[] parameters2, LookupEnvironment environment) -
toString
-