コード例 #1
0
  /** Bind and add argument's binding into the scope of the method */
  public void bindArguments() {

    if (this.arguments != null) {
      // by default arguments in abstract/native methods are considered to be used (no complaint is
      // expected)
      if (this.binding == null) {
        for (int i = 0, length = this.arguments.length; i < length; i++) {
          this.arguments[i].bind(this.scope, null, true);
        }
        return;
      }
      boolean used = this.binding.isAbstract() || this.binding.isNative();
      AnnotationBinding[][] paramAnnotations = null;
      for (int i = 0, length = this.arguments.length; i < length; i++) {
        Argument argument = this.arguments[i];
        argument.bind(this.scope, this.binding.parameters[i], used);
        if (argument.annotations != null) {
          if (paramAnnotations == null) {
            paramAnnotations = new AnnotationBinding[length][];
            for (int j = 0; j < i; j++) {
              paramAnnotations[j] = Binding.NO_ANNOTATIONS;
            }
          }
          paramAnnotations[i] = argument.binding.getAnnotations();
        } else if (paramAnnotations != null) {
          paramAnnotations[i] = Binding.NO_ANNOTATIONS;
        }
      }
      if (paramAnnotations != null) this.binding.setParameterAnnotations(paramAnnotations);
    }
  }
コード例 #2
0
 /**
  * When a method is accessed via SourceTypeBinding.resolveTypesFor(MethodBinding) we create the
  * argument binding and resolve annotations in order to compute null annotation tagbits.
  */
 public void createArgumentBindings() {
   if (this.arguments != null && this.binding != null) {
     for (int i = 0, length = this.arguments.length; i < length; i++) {
       Argument argument = this.arguments[i];
       argument.createBinding(this.scope, this.binding.parameters[i]);
       // createBinding() has resolved annotations, now transfer nullness info from the argument to
       // the method:
       if ((argument.binding.tagBits & (TagBits.AnnotationNonNull | TagBits.AnnotationNullable))
           != 0) {
         if (this.binding.parameterNonNullness == null)
           this.binding.parameterNonNullness = new Boolean[this.arguments.length];
         this.binding.parameterNonNullness[i] =
             Boolean.valueOf((argument.binding.tagBits & TagBits.AnnotationNonNull) != 0);
       }
     }
   }
 }
コード例 #3
0
 // version for invocation from LambdaExpression:
 static void createArgumentBindings(
     Argument[] arguments, MethodBinding binding, MethodScope scope) {
   boolean useTypeAnnotations = scope.environment().usesNullTypeAnnotations();
   if (arguments != null && binding != null) {
     for (int i = 0, length = arguments.length; i < length; i++) {
       Argument argument = arguments[i];
       binding.parameters[i] = argument.createBinding(scope, binding.parameters[i]);
       if (useTypeAnnotations) continue; // no business with SE7 null annotations in the 1.8 case.
       // createBinding() has resolved annotations, now transfer nullness info from the argument to
       // the method:
       long argTypeTagBits = (argument.binding.tagBits & TagBits.AnnotationNullMASK);
       if (argTypeTagBits != 0) {
         if (binding.parameterNonNullness == null) {
           binding.parameterNonNullness = new Boolean[arguments.length];
           binding.tagBits |= TagBits.IsNullnessKnown;
         }
         binding.parameterNonNullness[i] =
             Boolean.valueOf(argTypeTagBits == TagBits.AnnotationNonNull);
       }
     }
   }
 }