Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.Argument


  TypeBinding [] inheritedParameterTypes = inheritedMethod.parameters;
  Argument[] arguments = methodDecl.arguments;
  for (int j = 0, size = currentMethod.parameters.length; j < size; j++) {
    TypeBinding parameterType = parameterTypes[j];
    TypeBinding inheritedParameterType = inheritedParameterTypes[j];
    Argument arg = arguments[j];
    if (parameterType.leafComponentType().isRawType()) {
      if (inheritedParameterType.leafComponentType().isRawType()) {
        arg.binding.tagBits |= TagBits.ForcedToBeRawType;
      } else {
        if (compilerOptions.getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore
View Full Code Here


      TypeReference typeReference = createTypeReference(argumentTypeName);
      if (typeReference == null) return null;
      if (isVarargs && i == argumentCount-1) {
        typeReference.bits |= ASTNode.IsVarArgs;
      }
      methodDeclaration.arguments[i] = new Argument(
        argumentNames[i].toCharArray(),
        0,
        typeReference,
        ClassFileConstants.AccDefault);
      // do not care whether was final or not
View Full Code Here

              int argumentCount = arguments.length;
              if (parameterCount > argumentCount) { // synthetics prefixed
                int redShift = parameterCount - argumentCount;
                System.arraycopy(arguments, 0, arguments = new Argument[parameterCount], redShift, argumentCount);
                for (int i = 0; i < redShift; i++)
                  arguments[i] = new Argument(CharOperation.NO_CHAR, 0, null, 0);
              }
              attributesNumber += generateRuntimeAnnotationsForParameters(arguments);
            }
          } 
        }
View Full Code Here

    final int INVISIBLE_INDEX = 1;
    int invisibleParametersAnnotationsCounter = 0;
    int visibleParametersAnnotationsCounter = 0;
    int[][] annotationsCounters = new int[argumentsLength][2];
    for (int i = 0; i < argumentsLength; i++) {
      Argument argument = arguments[i];
      Annotation[] annotations = argument.annotations;
      if (annotations != null) {
        for (int j = 0, max2 = annotations.length; j < max2; j++) {
          Annotation annotation;
          if ((annotation = annotations[j].getPersistibleAnnotation()) == null) continue; // already packaged into container.
          long annotationMask = annotation.resolvedType != null ? annotation.resolvedType.getAnnotationTagBits() & TagBits.AnnotationTargetMASK : 0;
          if (annotationMask != 0 && (annotationMask & TagBits.AnnotationForParameter) == 0) continue;
          if (annotation.isRuntimeInvisible()) {
            annotationsCounters[i][INVISIBLE_INDEX]++;
            invisibleParametersAnnotationsCounter++;
          } else if (annotation.isRuntimeVisible()) {
            annotationsCounters[i][VISIBLE_INDEX]++;
            visibleParametersAnnotationsCounter++;
          }
        }
      }
    }
    int attributesNumber = 0;
    int annotationAttributeOffset = this.contentsOffset;
    if (invisibleParametersAnnotationsCounter != 0) {
      int globalCounter = 0;
      if (this.contentsOffset + 7 >= this.contents.length) {
        resizeContents(7);
      }
      int attributeNameIndex =
        this.constantPool.literalIndex(AttributeNamesConstants.RuntimeInvisibleParameterAnnotationsName);
      this.contents[this.contentsOffset++] = (byte) (attributeNameIndex >> 8);
      this.contents[this.contentsOffset++] = (byte) attributeNameIndex;
      int attributeLengthOffset = this.contentsOffset;
      this.contentsOffset += 4; // leave space for the attribute length

      this.contents[this.contentsOffset++] = (byte) argumentsLength;
      for (int i = 0; i < argumentsLength; i++) {
        if (this.contentsOffset + 2 >= this.contents.length) {
          resizeContents(2);
        }
        if (invisibleParametersAnnotationsCounter == 0) {
          this.contents[this.contentsOffset++] = (byte) 0;
          this.contents[this.contentsOffset++] = (byte) 0;
        } else {
          final int numberOfInvisibleAnnotations = annotationsCounters[i][INVISIBLE_INDEX];
          int invisibleAnnotationsOffset = this.contentsOffset;
          // leave space for number of annotations
          this.contentsOffset += 2;
          int counter = 0;
          if (numberOfInvisibleAnnotations != 0) {
            Argument argument = arguments[i];
            Annotation[] annotations = argument.annotations;
            for (int j = 0, max = annotations.length; j < max; j++) {
              Annotation annotation;
              if ((annotation = annotations[j].getPersistibleAnnotation()) == null) continue; // already packaged into container.
              long annotationMask = annotation.resolvedType != null ? annotation.resolvedType.getAnnotationTagBits() & TagBits.AnnotationTargetMASK : 0;
              if (annotationMask != 0 && (annotationMask & TagBits.AnnotationForParameter) == 0) continue;
              if (annotation.isRuntimeInvisible()) {
                int currentAnnotationOffset = this.contentsOffset;
                generateAnnotation(annotation, currentAnnotationOffset);
                if (this.contentsOffset != currentAnnotationOffset) {
                  counter++;
                  globalCounter++;
                }
                invisibleParametersAnnotationsCounter--;
              }
            }
          }
          this.contents[invisibleAnnotationsOffset++] = (byte) (counter >> 8);
          this.contents[invisibleAnnotationsOffset] = (byte) counter;
        }
      }
      if (globalCounter != 0) {
        int attributeLength = this.contentsOffset - attributeLengthOffset - 4;
        this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 24);
        this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 16);
        this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 8);
        this.contents[attributeLengthOffset++] = (byte) attributeLength;
        attributesNumber++;
      } else {
        // if globalCounter is 0, this means that the code generation for all visible annotations failed
        this.contentsOffset = annotationAttributeOffset;
      }
    }
    if (visibleParametersAnnotationsCounter != 0) {
      int globalCounter = 0;
      if (this.contentsOffset + 7 >= this.contents.length) {
        resizeContents(7);
      }
      int attributeNameIndex =
        this.constantPool.literalIndex(AttributeNamesConstants.RuntimeVisibleParameterAnnotationsName);
      this.contents[this.contentsOffset++] = (byte) (attributeNameIndex >> 8);
      this.contents[this.contentsOffset++] = (byte) attributeNameIndex;
      int attributeLengthOffset = this.contentsOffset;
      this.contentsOffset += 4; // leave space for the attribute length

      this.contents[this.contentsOffset++] = (byte) argumentsLength;
      for (int i = 0; i < argumentsLength; i++) {
        if (this.contentsOffset + 2 >= this.contents.length) {
          resizeContents(2);
        }
        if (visibleParametersAnnotationsCounter == 0) {
          this.contents[this.contentsOffset++] = (byte) 0;
          this.contents[this.contentsOffset++] = (byte) 0;
        } else {
          final int numberOfVisibleAnnotations = annotationsCounters[i][VISIBLE_INDEX];
          int visibleAnnotationsOffset = this.contentsOffset;
          // leave space for number of annotations
          this.contentsOffset += 2;
          int counter = 0;
          if (numberOfVisibleAnnotations != 0) {
            Argument argument = arguments[i];
            Annotation[] annotations = argument.annotations;
            for (int j = 0, max = annotations.length; j < max; j++) {
              Annotation annotation;
              if ((annotation = annotations[j].getPersistibleAnnotation()) == null) continue; // already packaged into container.
              long annotationMask = annotation.resolvedType != null ? annotation.resolvedType.getAnnotationTagBits() & TagBits.AnnotationTargetMASK : 0;
View Full Code Here

      } else if (binding.sourceLambda() != null) { // SyntheticMethodBinding, purpose : LambdaMethod.
        arguments = binding.sourceLambda().arguments;
      }
      for (int i = 0, max = targetParameters.length, argumentsLength = arguments != null ? arguments.length : 0; i < max; i++) {
        if (argumentsLength > i && arguments[i] != null) {
          Argument argument = arguments[i];
          length = writeArgumentName(argument.name, argument.binding.modifiers, length);
        } else {
          length = writeArgumentName(null, ClassFileConstants.AccSynthetic, length);
        }
      }
View Full Code Here

  int argumentLength = arguments.length;
  char[][] argumentTypes = new char[argumentLength][];
  char[][] argumentNames = new char[argumentLength][];
  ParameterInfo[] parameterInfos = new ParameterInfo[argumentLength];
  for (int i = 0; i < argumentLength; i++) {
    Argument argument = arguments[i];
    argumentTypes[i] = CharOperation.concatWith(argument.type.getParameterizedTypeName(), '.');
    char[] name = argument.name;
    argumentNames[i] = name;
    ParameterInfo parameterInfo = new ParameterInfo();
    parameterInfo.declarationStart = argument.declarationSourceStart;
View Full Code Here

    if (this.declaringClass instanceof SourceTypeBinding) {
      SourceTypeBinding sourceType = (SourceTypeBinding) this.declaringClass;
      if (sourceType.scope != null) {
        AbstractMethodDeclaration methodDecl = sourceType.scope.referenceType().declarationOf(this);
        for (int i = 0; i < length; i++) {
          Argument argument = methodDecl.arguments[i];
          if (argument.annotations != null) {
            ASTNode.resolveAnnotations(methodDecl.scope, argument.annotations, argument.binding);
            allParameterAnnotations[i] = argument.binding.getAnnotations();
          } else {
            allParameterAnnotations[i] = Binding.NO_ANNOTATIONS;
View Full Code Here

          }
        }
        for (int i=0; i<paramLen; i++) {
          info = inheritedNonNullnessInfos[i+1];
          if (!info.complained && info.inheritedNonNullness != null) {
            Argument currentArg = srcMethod == null ? null : srcMethod.arguments[i];
            if (sourceLevel < ClassFileConstants.JDK1_8)
              recordArgNonNullness(currentMethod, paramLen, i, currentArg, info.inheritedNonNullness);
            else
              recordArgNonNullness18(currentMethod, i, currentArg, info.inheritedNonNullness, scope.environment());
          }
View Full Code Here

      length = currentMethod.parameterNonNullness.length;

    for (int i = 0; i < length; i++) {
      if (currentMethod.parameters[i].isBaseType()) continue;

      Argument currentArgument = currentArguments == null
                    ? null : currentArguments[i];
      Boolean inheritedNonNullNess = getParameterNonNullness(inheritedMethod, i, useTypeAnnotations);
      Boolean currentNonNullNess = getParameterNonNullness(currentMethod, i, useTypeAnnotations);

      if (currentNonNullNess == null) {
View Full Code Here

private LocalVariable[] acceptMethodParameters(Argument[] arguments, JavaElement methodHandle, MethodInfo methodInfo) {
  if (arguments == null) return null;
  LocalVariable[] result = new LocalVariable[arguments.length];
  Annotation[][] paramAnnotations = new Annotation[arguments.length][];
  for(int i = 0; i < arguments.length; i++) {
    Argument argument = arguments[i];
    AnnotatableInfo localVarInfo = new AnnotatableInfo();
    localVarInfo.setSourceRangeStart(argument.declarationSourceStart);
    localVarInfo.setSourceRangeEnd(argument.declarationSourceStart);
    localVarInfo.setNameSourceStart(argument.sourceStart);
    localVarInfo.setNameSourceEnd(argument.sourceEnd);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.Argument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.