Klasse NullAnnotationMatching

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.ast.NullAnnotationMatching

public class NullAnnotationMatching extends Object
Performs matching of null type annotations. Instances are used to encode result from this analysis.
Seit:
3.10
  • Felddetails

    • NULL_ANNOTATIONS_OK

      public static final NullAnnotationMatching NULL_ANNOTATIONS_OK
    • NULL_ANNOTATIONS_OK_NONNULL

      public static final NullAnnotationMatching NULL_ANNOTATIONS_OK_NONNULL
    • NULL_ANNOTATIONS_UNCHECKED

      public static final NullAnnotationMatching NULL_ANNOTATIONS_UNCHECKED
    • NULL_ANNOTATIONS_MISMATCH

      public static final NullAnnotationMatching NULL_ANNOTATIONS_MISMATCH
    • superTypeHint

      public final TypeBinding 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

      public NullAnnotationMatching withNullStatus(int updatedNullStatus)
      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

      public String superTypeHintName(CompilerOptions options, boolean shortNames)
    • 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 - TODO
      nullStatus - we are only interested in NULL or NON_NULL, -1 indicates that we are in a recursion, where flow info is ignored
      providedExpression - optionally holds the provided expression of type 'providedType'
      mode - controls the kind of check performed (see NullAnnotationMatching.CheckMode).
      Gibt zurück:
      a status object representing the severity of mismatching plus optionally a supertype hint
    • report

      public void report(Scope scope)
    • getProblemId

      public int getProblemId(TypeBinding requiredType)
    • okNonNullStatus

      public static NullAnnotationMatching okNonNullStatus(Expression providedExpression)
    • 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

      public static int nullStatusFromExpressionType(TypeBinding type)
      Use only if no suitable flowInfo is available.
    • validNullTagBits

      public static long validNullTagBits(long bits)
    • moreDangerousType

      public static TypeBinding moreDangerousType(TypeBinding one, TypeBinding two)
    • 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

      public static boolean hasContradictions(TypeBinding type)
    • strongerType

      public static TypeBinding strongerType(TypeBinding type1, TypeBinding type2, LookupEnvironment environment)
    • weakerTypes

      public static TypeBinding[] weakerTypes(TypeBinding[] parameters1, TypeBinding[] parameters2, LookupEnvironment environment)
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object