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

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


    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 = annotations[j];
          if (isRuntimeInvisible(annotation)) {
            annotationsCounters[i][INVISIBLE_INDEX]++;
            invisibleParametersAnnotationsCounter++;
          } else if (isRuntimeVisible(annotation)) {
            annotationsCounters[i][VISIBLE_INDEX]++;
            visibleParametersAnnotationsCounter++;
          }
        }
      }
    }
    int attributesNumber = 0;
    int annotationAttributeOffset = contentsOffset;
    if (invisibleParametersAnnotationsCounter != 0) {
      if (contentsOffset + 7 >= contents.length) {
        resizeContents(7);
      }
      int attributeNameIndex =
        constantPool.literalIndex(AttributeNamesConstants.RuntimeInvisibleParameterAnnotationsName);
      contents[contentsOffset++] = (byte) (attributeNameIndex >> 8);
      contents[contentsOffset++] = (byte) attributeNameIndex;
      int attributeLengthOffset = contentsOffset;
      contentsOffset += 4; // leave space for the attribute length

      contents[contentsOffset++] = (byte) argumentsLength;
      invisibleLoop: for (int i = 0; i < argumentsLength; i++) {
        if (contentsOffset + 2 >= contents.length) {
          resizeContents(2);
        }
        if (invisibleParametersAnnotationsCounter == 0) {
          contents[contentsOffset++] = (byte) 0;
          contents[contentsOffset++] = (byte) 0;         
        } else {
          final int numberOfInvisibleAnnotations = annotationsCounters[i][INVISIBLE_INDEX];
          contents[contentsOffset++] = (byte) (numberOfInvisibleAnnotations >> 8);
          contents[contentsOffset++] = (byte) numberOfInvisibleAnnotations;
          if (numberOfInvisibleAnnotations != 0) {
            Argument argument = arguments[i];
            Annotation[] annotations = argument.annotations;
            for (int j = 0, max = annotations.length; j < max; j++) {
              Annotation annotation = annotations[j];
              if (isRuntimeInvisible(annotation)) {
                generateAnnotation(annotation, annotationAttributeOffset);
                if (contentsOffset == annotationAttributeOffset) {
                  break invisibleLoop;
                }
                invisibleParametersAnnotationsCounter--;
              }
            }
          }
        }
      }
      if (contentsOffset != annotationAttributeOffset) {
        int attributeLength = contentsOffset - attributeLengthOffset - 4;
        contents[attributeLengthOffset++] = (byte) (attributeLength >> 24);
        contents[attributeLengthOffset++] = (byte) (attributeLength >> 16);
        contents[attributeLengthOffset++] = (byte) (attributeLength >> 8);
        contents[attributeLengthOffset++] = (byte) attributeLength;     
        attributesNumber++;
      } else {
        contentsOffset = annotationAttributeOffset;
      }
    }
    if (visibleParametersAnnotationsCounter != 0) {
      if (contentsOffset + 7 >= contents.length) {
        resizeContents(7);
      }
      int attributeNameIndex =
        constantPool.literalIndex(AttributeNamesConstants.RuntimeVisibleParameterAnnotationsName);
      contents[contentsOffset++] = (byte) (attributeNameIndex >> 8);
      contents[contentsOffset++] = (byte) attributeNameIndex;
      int attributeLengthOffset = contentsOffset;
      contentsOffset += 4; // leave space for the attribute length

      contents[contentsOffset++] = (byte) argumentsLength;
      visibleLoop: for (int i = 0; i < argumentsLength; i++) {
        if (contentsOffset + 2 >= contents.length) {
          resizeContents(2);
        }
        if (visibleParametersAnnotationsCounter == 0) {
          contents[contentsOffset++] = (byte) 0;
          contents[contentsOffset++] = (byte) 0;         
        } else {
          final int numberOfVisibleAnnotations = annotationsCounters[i][VISIBLE_INDEX];
          contents[contentsOffset++] = (byte) (numberOfVisibleAnnotations >> 8);
          contents[contentsOffset++] = (byte) numberOfVisibleAnnotations;
          if (numberOfVisibleAnnotations != 0) {
            Argument argument = arguments[i];
            Annotation[] annotations = argument.annotations;
            for (int j = 0, max = annotations.length; j < max; j++) {
              Annotation annotation = annotations[j];
              if (isRuntimeVisible(annotation)) {
                generateAnnotation(annotation, annotationAttributeOffset);
View Full Code Here


    }
    EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(mDecl.scope);
    String extraArgName = "";// maybeGetExtraArgName();
    FormalBinding[] ret = new FormalBinding[mDecl.arguments.length];
    for (int i = 0; i < mDecl.arguments.length; i++) {
      Argument arg = mDecl.arguments[i];
      String name = new String(arg.name);
      TypeBinding argTypeBinding = mDecl.binding.parameters[i];
      UnresolvedType type = factory.fromBinding(argTypeBinding);
      if (CharOperation.equals(joinPoint, argTypeBinding.signature())
          || CharOperation.equals(joinPointStaticPart, argTypeBinding.signature())
View Full Code Here

    TypeBinding[] parameters = method.parameters;
    Argument[] arguments = dec.arguments;

    FormalBinding[] bindings = new FormalBinding[baseArgumentCount];
    for (int i = 0, len = baseArgumentCount; i < len; i++) {
      Argument arg = arguments[i];
      String name = new String(arg.name);
      UnresolvedType type = world.fromBinding(parameters[i]);
      // pr268710: allow for inner interfaces in a generic aspect
      if (parameters[i].isInterface() && parameters[i].isParameterizedType() && parameters[i].isMemberType()) {
        TypeVariableBinding[] tvs = parameters[i].typeVariables();
View Full Code Here

        // to compute bodyStart, and thus used to set next checkpoint.
        int count;
        for (count = 0; count < argLength; count++){
          ASTNode aNode = parser.astStack[argStart+count];
          if(aNode instanceof Argument) {
            Argument argument = (Argument)aNode;
            /* cannot be an argument if non final */
            char[][] argTypeName = argument.type.getTypeName();
            if ((argument.modifiers & ~ClassFileConstants.AccFinal) != 0
              || (argTypeName.length == 1
                && CharOperation.equals(argTypeName[0], TypeBinding.VOID.sourceName()))){
View Full Code Here

    if (argType.startsWith("Lorg/aspectj/runtime/internal"))
      return;

    // If the unused argument is in a pointcut, don't report the problem (for now... pr148219)
    if (localDecl instanceof Argument) {
      Argument arg = (Argument) localDecl;
      if (arg.binding != null && arg.binding.declaringScope != null) {
        ReferenceContext context = arg.binding.declaringScope.referenceContext();
        if (context != null && context instanceof PointcutDeclaration)
          return;
      }
View Full Code Here

   
    pushOnAstStack(adviceDecl);
  }
 
  protected void consumeExtraParameterWithFormal() {
    Argument arg = (Argument)astStack[astPtr--];
    astLengthPtr--;
   
    declarationFactory.setExtraArgument((MethodDeclaration)astStack[astPtr],arg);
   
    consumeExtraParameterNoFormal();
View Full Code Here

    String extraArgName = maybeGetExtraArgName();
    if (extraArgName == null)
      extraArgName = "";
    FormalBinding[] ret = new FormalBinding[mDecl.arguments.length];
    for (int i = 0; i < mDecl.arguments.length; i++) {
      Argument arg = mDecl.arguments[i];
      String name = new String(arg.name);
      TypeBinding argTypeBinding = mDecl.binding.parameters[i];
      UnresolvedType type = factory.fromBinding(argTypeBinding);
      if (CharOperation.equals(joinPoint, argTypeBinding.signature())
          || CharOperation.equals(joinPointStaticPart, argTypeBinding.signature())
View Full Code Here

    return arguments;
  }

  private static Argument makeFinalArgument(String name, TypeReference typeRef) {
    long pos = 0; // XXX encode start and end location
    return new Argument(name.toCharArray(), pos, typeRef, Modifier.FINAL);
  }
View Full Code Here

      String argumentTypeName = argumentTypeNames[i];
      TypeReference typeReference = createTypeReference(Signature.toString(argumentTypeName).toCharArray());
      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

      len = ((AdviceDeclaration) enclosingDec).baseArgumentCount;
    }

    Argument[] ret = new Argument[len];
    for (int i = 0; i < len; i++) {
      Argument a = baseArguments[i];
      ret[i] = new Argument(a.name, AstUtil.makeLongPos(a.sourceStart, a.sourceEnd), a.type, Modifier.FINAL);
    }
    ret = AdviceDeclaration.addTjpArguments(ret);

    return ret;
  }
View Full Code Here

TOP

Related Classes of org.aspectj.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.