Examples of LocalVariableTable


Examples of org.aspectj.apache.bcel.classfile.LocalVariableTable

  public void determineParameterNames() {
    if ((bitflags & PARAMETER_NAMES_INITIALIZED) != 0) {
      return;
    }
    bitflags |= PARAMETER_NAMES_INITIALIZED;
    LocalVariableTable varTable = method.getLocalVariableTable();
    int len = getArity();
    if (varTable == null) {
      // do we have an annotation with the argNames value specified...
      AnnotationAJ[] annos = getAnnotations();
      if (annos != null && annos.length != 0) {
        AnnotationAJ[] axs = getAnnotations();
        for (int i = 0; i < axs.length; i++) {
          AnnotationAJ annotationX = axs[i];
          String typename = annotationX.getTypeName();
          if (typename.charAt(0) == 'o') {
            if (typename.equals("org.aspectj.lang.annotation.Pointcut")
                || typename.equals("org.aspectj.lang.annotation.Before")
                || typename.equals("org.aspectj.lang.annotation.Around")
                || typename.startsWith("org.aspectj.lang.annotation.After")) {
              AnnotationGen a = ((BcelAnnotation) annotationX).getBcelAnnotation();
              if (a != null) {
                List<NameValuePair> values = a.getValues();
                for (NameValuePair nvPair : values) {
                  if (nvPair.getNameString().equals("argNames")) {
                    String argNames = nvPair.getValue().stringifyValue();
                    StringTokenizer argNameTokenizer = new StringTokenizer(argNames, " ,");
                    List<String> argsList = new ArrayList<String>();
                    while (argNameTokenizer.hasMoreTokens()) {
                      argsList.add(argNameTokenizer.nextToken());
                    }
                    int requiredCount = getParameterTypes().length;
                    while (argsList.size() < requiredCount) {
                      argsList.add("arg" + argsList.size());
                    }
                    setParameterNames(argsList.toArray(new String[] {}));
                    return;
                  }
                }
              }
            }
          }
        }
      }
      setParameterNames(Utility.makeArgNames(len));
    } else {
      UnresolvedType[] paramTypes = getParameterTypes();
      String[] paramNames = new String[len];
      int index = Modifier.isStatic(modifiers) ? 0 : 1;
      for (int i = 0; i < len; i++) {
        LocalVariable lv = varTable.getLocalVariable(index);
        if (lv == null) {
          paramNames[i] = "arg" + i;
        } else {
          paramNames[i] = lv.getName();
        }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LocalVariableTable

      InstructionHandle start = il.getStart();
      if (lineNumber > 0) {
        start.addTargeter(new LineNumberTag(lineNumber));
      }
      // Fix up the local variables: find any that have a startPC of 0 and ensure they target the new start of the method
      LocalVariableTable lvt = shadow.getEnclosingMethod().getMemberView().getMethod().getLocalVariableTable();
      if (lvt != null) {
        LocalVariable[] lvTable = lvt.getLocalVariableTable();
        for (int i = 0; i < lvTable.length; i++) {
          LocalVariable lv = lvTable[i];
          if (lv.getStartPC() == 0) {
            start.addTargeter(new LocalVariableTag(lv.getSignature(), lv.getName(), lv.getIndex(), 0));
          }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LocalVariableTable

    for (int i = 0; i < size; i++) {
      lv[i] = lg[i].getLocalVariable(cp);
    }

    return new LocalVariableTable(cp.addUtf8("LocalVariableTable"), 2 + lv.length * 10, lv, cp);
  }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LocalVariableTable

            + this.getName() + this.getSignature(), e);
      }
    }

    LineNumberTable lnt = null;
    LocalVariableTable lvt = null;
    // J5TODO: LocalVariableTypeTable support!

    /*
     * Create LocalVariableTable and LineNumberTable attributes (for debuggers, e.g.)
     */
 
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LocalVariableTable

    if (!(forMember instanceof AccessibleObject))
      return null;

    try {
      JavaClass jc = bcelRepository.loadClass(forMember.getDeclaringClass());
      LocalVariableTable lvt = null;
      int numVars = 0;
      if (forMember instanceof Method) {
        org.aspectj.apache.bcel.classfile.Method bcelMethod = jc.getMethod((Method) forMember);
        lvt = bcelMethod.getLocalVariableTable();
        numVars = bcelMethod.getArgumentTypes().length;
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LocalVariableTable

      return EMPTY_STRINGS;
    }

    final int startAtStackIndex = method.isStatic() ? 0 : 1;
    final List<MethodArgument> arguments = new ArrayList<MethodArgument>();
    LocalVariableTable lt = method.getLocalVariableTable();
    if (lt != null) {
      LocalVariable[] lvt = lt.getLocalVariableTable();
      for (int j = 0; j < lvt.length; j++) {
        LocalVariable localVariable = lvt[j];
        if (localVariable != null) { // pr348488
          if (localVariable.getStartPC() == 0) {
            if (localVariable.getIndex() >= startAtStackIndex) {
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LocalVariableTable

      return EMPTY_STRINGS;
    }

    final int startAtStackIndex = method.isStatic() ? 0 : 1;
    final List<MethodArgument> arguments = new ArrayList<MethodArgument>();
    LocalVariableTable lt = method.getLocalVariableTable();
    if (lt != null) {
      LocalVariable[] lvt = lt.getLocalVariableTable();
      for (int j = 0; j < lvt.length; j++) {
        LocalVariable localVariable = lvt[j];
        if (localVariable.getStartPC() == 0) {
          if (localVariable.getIndex() >= startAtStackIndex) {
            arguments.add(new MethodArgument(localVariable.getName(), localVariable.getIndex()));
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LocalVariableTable

  public void determineParameterNames() {
    if ((bitflags & PARAMETER_NAMES_INITIALIZED) != 0) {
      return;
    }
    bitflags |= PARAMETER_NAMES_INITIALIZED;
    LocalVariableTable varTable = method.getLocalVariableTable();
    int len = getArity();
    if (varTable == null) {
      // do we have an annotation with the argNames value specified...
      if (hasAnnotations()) {
        AnnotationAJ[] axs = getAnnotations();
        for (int i = 0; i < axs.length; i++) {
          AnnotationAJ annotationX = axs[i];
          String typename = annotationX.getTypeName();
          if (typename.charAt(0) == 'o') {
            if (typename.equals("org.aspectj.lang.annotation.Pointcut")
                || typename.equals("org.aspectj.lang.annotation.Before")
                || typename.equals("org.aspectj.lang.annotation.Around")
                || typename.startsWith("org.aspectj.lang.annotation.After")) {
              AnnotationGen a = ((BcelAnnotation) annotationX).getBcelAnnotation();
              if (a != null) {
                List<NameValuePair> values = a.getValues();
                for (NameValuePair nvPair : values) {
                  if (nvPair.getNameString().equals("argNames")) {
                    String argNames = nvPair.getValue().stringifyValue();
                    StringTokenizer argNameTokenizer = new StringTokenizer(argNames, " ,");
                    List<String> argsList = new ArrayList<String>();
                    while (argNameTokenizer.hasMoreTokens()) {
                      argsList.add(argNameTokenizer.nextToken());
                    }
                    int requiredCount = getParameterTypes().length;
                    while (argsList.size() < requiredCount) {
                      argsList.add("arg" + argsList.size());
                    }
                    setParameterNames(argsList.toArray(new String[] {}));
                    return;
                  }
                }
              }
            }
          }
        }
      }
      setParameterNames(Utility.makeArgNames(len));
    } else {
      UnresolvedType[] paramTypes = getParameterTypes();
      String[] paramNames = new String[len];
      int index = Modifier.isStatic(modifiers) ? 0 : 1;
      for (int i = 0; i < len; i++) {
        LocalVariable lv = varTable.getLocalVariable(index);
        if (lv == null) {
          paramNames[i] = "arg" + i;
        } else {
          paramNames[i] = lv.getName();
        }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LocalVariableTable

        //Here because its easier to collect the information of the
        //(possibly more than one) LocalVariableTables belonging to
        //one certain Code attribute.
        if (atts[a] instanceof LocalVariableTable){ // checks conforming to vmspec2 4.7.9

          LocalVariableTable lvt = (LocalVariableTable) atts[a];

          checkIndex(lvt, lvt.getNameIndex(), CONST_Utf8);

          String lvtname = ((ConstantUtf8) cp.getConstant(lvt.getNameIndex())).getBytes();
          if (! lvtname.equals("LocalVariableTable")){
            throw new ClassConstraintException("The LocalVariableTable attribute '"+tostring(lvt)+"' is not correctly named 'LocalVariableTable' but '"+lvtname+"'.");
          }

          Code code = obj;

          //In JustIce, the check for correct offsets into the code array is delayed to Pass 3a.
          LocalVariable[] localvariables = lvt.getLocalVariableTable();

          for (int i=0; i<localvariables.length; i++){
            checkIndex(lvt, localvariables[i].getNameIndex(), CONST_Utf8);
            String localname = ((ConstantUtf8) cp.getConstant(localvariables[i].getNameIndex())).getBytes();
            if (!validJavaIdentifier(localname)){
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LocalVariableTable

    /* We cannot use code.getLocalVariableTable() because there could be more
       than only one. This is a bug in BCEL. */
    Attribute[] atts = code.getAttributes();
    for (int a=0; a<atts.length; a++){
      if (atts[a] instanceof LocalVariableTable){
        LocalVariableTable lvt = (LocalVariableTable) atts[a];
        if (lvt != null){
          LocalVariable[] localVariables = lvt.getLocalVariableTable();
          for (int i=0; i<localVariables.length; i++){
            int startpc = localVariables[i].getStartPC();
            int length  = localVariables[i].getLength();
       
            if (!contains(instructionPositions, startpc)){
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.