Package org.aspectj.apache.bcel.generic

Examples of org.aspectj.apache.bcel.generic.LocalVariableTag


      // System.out.println("got store: " + startOfHandler.getInstruction() + ", " + index);
      Iterator tIter = startOfHandler.getNext().getTargeters().iterator();
      while (tIter.hasNext()) {
        InstructionTargeter targeter = (InstructionTargeter) tIter.next();
        if (targeter instanceof LocalVariableTag) {
          LocalVariableTag t = (LocalVariableTag) targeter;
          if (t.getSlot() == slot) {
            return t.getName();
          }
        }
      }
    }
View Full Code Here


        searchPtr = searchPtr.getPrev();
      }

      // A load instruction may tell us the real type of what the clone() call is on
      if (searchPtr.getInstruction().isLoadInstruction()) {
        LocalVariableTag lvt = LazyMethodGen.getLocalVariableTag(searchPtr, searchPtr.getInstruction().getIndex());
        if (lvt != null) {
          return UnresolvedType.forSignature(lvt.getType());
        }
      }
      // A field access instruction may tell us the real type of what the clone() call is on
      if (searchPtr.getInstruction() instanceof FieldInstruction) {
        FieldInstruction si = (FieldInstruction) searchPtr.getInstruction();
View Full Code Here

        argumentName = new StringBuffer("unknown").append(argNumber).toString();
      } else {
        argumentName = parameterNames.get(argNumber);
      }
      String argumentSignature = args[argNumber].getSignature();
      LocalVariableTag lvt = new LocalVariableTag(argumentSignature, argumentName, slot, 0);
      start.addTargeter(lvt);
      end.addTargeter(lvt);
      slot += args[argNumber].getSize();
    }
  }
View Full Code Here

      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

          Tag fresh = tagMap.get(oldTag);
          if (fresh == null) {
            fresh = oldTag.copy();
            if (old instanceof LocalVariableTag) {
              // LocalVariable
              LocalVariableTag lvTag = (LocalVariableTag) old;
              LocalVariableTag lvTagFresh = (LocalVariableTag) fresh;
              if (lvTag.getSlot() == 0) {
                fresh = new LocalVariableTag(lvTag.getRealType().getSignature(), "ajc$aspectInstance",
                    frameEnv.get(lvTag.getSlot()), 0);
              } else {
                // // Do not move it - when copying the code from the aspect to the affected target, 'this' is
                // // going to change from aspect to affected type. So just fix the type
                // System.out.println("For local variable tag at instruction " + src + " changing slot from "
                // + lvTag.getSlot() + " > " + frameEnv.get(lvTag.getSlot()));
                lvTagFresh.updateSlot(frameEnv.get(lvTag.getSlot()));
              }
            }
            tagMap.put(oldTag, fresh);
          }
          dest.addTargeter(fresh);
View Full Code Here

      } else if (inst.isLocalVariableInstruction()) {
        // LocalVariableInstruction lvinst = (LocalVariableInstruction)
        // inst;
        out.print(inst.toString(false).toUpperCase());
        int index = inst.getIndex();
        LocalVariableTag tag = getLocalVariableTag(h, index);
        if (tag != null) {
          out.print("     // ");
          out.print(tag.getType());
          out.print(" ");
          out.print(tag.getName());
        }
      } else {
        out.print(inst.toString(false).toUpperCase());
      }
    }
View Full Code Here

  }

  static LocalVariableTag getLocalVariableTag(InstructionHandle ih, int index) {
    for (InstructionTargeter t : ih.getTargeters()) {
      if (t instanceof LocalVariableTag) {
        LocalVariableTag lvt = (LocalVariableTag) t;
        if (lvt.getSlot() == index) {
          return lvt;
        }
      }
    }
    return null;
View Full Code Here

            if (line != currLine) {
              gen.addLineNumber(newInstructionHandle, line + lineNumberOffset);
              currLine = line;
            }
          } else if (targeter instanceof LocalVariableTag) {
            LocalVariableTag lvt = (LocalVariableTag) targeter;
            LVPosition p = localVariables.get(lvt);
            // If we don't know about it, create a new position and
            // store
            // If we do know about it - update its end position
            if (p == null) {
View Full Code Here

            if (line != currLine) {
              gen.addLineNumber(iHandle, line + lineNumberOffset);
              currLine = line;
            }
          } else if (targeter instanceof LocalVariableTag) {
            LocalVariableTag lvt = (LocalVariableTag) targeter;
            LVPosition p = localVariables.get(lvt);
            // If we don't know about it, create a new position
            // and store
            // If we do know about it - update its end position
            if (p == null) {
View Full Code Here

    advice.addAnnotation(aaj);
    InstructionHandle start = adviceBody.getStart();

    // Setup the local variable targeters so that the binding will work
    String sig = concreteAspect.name.replace('.', '/');
    start.addTargeter(new LocalVariableTag("L" + sig + ";", "this", 0, start.getPosition()));
    if (paramNames.size() > 0) {
      for (int i = 0; i < paramNames.size(); i++) {
        start.addTargeter(new LocalVariableTag(paramTypes.get(i).getSignature(), paramNames.get(i), i + 1, start
            .getPosition()));
      }
    }

    // Record the new method in the class
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.generic.LocalVariableTag

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.