コード例 #1
0
 /**
  * Feed null information from argument annotations into the analysis and mark arguments as
  * assigned.
  */
 static void analyseArguments(
     LookupEnvironment environment,
     FlowInfo flowInfo,
     Argument[] methodArguments,
     MethodBinding methodBinding) {
   if (methodArguments != null) {
     boolean usesNullTypeAnnotations = environment.usesNullTypeAnnotations();
     int length = Math.min(methodBinding.parameters.length, methodArguments.length);
     for (int i = 0; i < length; i++) {
       if (usesNullTypeAnnotations) {
         // leverage null type annotations:
         long tagBits = methodBinding.parameters[i].tagBits & TagBits.AnnotationNullMASK;
         if (tagBits == TagBits.AnnotationNonNull)
           flowInfo.markAsDefinitelyNonNull(methodArguments[i].binding);
         else if (tagBits == TagBits.AnnotationNullable)
           flowInfo.markPotentiallyNullBit(methodArguments[i].binding);
       } else {
         if (methodBinding.parameterNonNullness != null) {
           // leverage null-info from parameter annotations:
           Boolean nonNullNess = methodBinding.parameterNonNullness[i];
           if (nonNullNess != null) {
             if (nonNullNess.booleanValue())
               flowInfo.markAsDefinitelyNonNull(methodArguments[i].binding);
             else flowInfo.markPotentiallyNullBit(methodArguments[i].binding);
           }
         }
       }
       // tag parameters as being set:
       flowInfo.markAsDefinitelyAssigned(methodArguments[i].binding);
     }
   }
 }
コード例 #2
0
 /**
  * Feed null information from argument annotations into the analysis and mark arguments as
  * assigned.
  */
 void analyseArguments(FlowInfo flowInfo) {
   if (this.arguments != null) {
     for (int i = 0, count = this.arguments.length; i < count; i++) {
       if (this.binding.parameterNonNullness != null) {
         // leverage null-info from parameter annotations:
         Boolean nonNullNess = this.binding.parameterNonNullness[i];
         if (nonNullNess != null) {
           if (nonNullNess.booleanValue())
             flowInfo.markAsDefinitelyNonNull(this.arguments[i].binding);
           else flowInfo.markPotentiallyNullBit(this.arguments[i].binding);
         }
       }
       // tag parameters as being set:
       flowInfo.markAsDefinitelyAssigned(this.arguments[i].binding);
     }
   }
 }