Package org.aspectj.apache.bcel.classfile

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


    }
  }

  // TODO setting the constant value is a mess...
  public void setValue(int index) {
    ConstantPool cp = this.cp;
    Constant c = cp.getConstant(index);
    if (c instanceof ConstantInteger) {
      value = ((ConstantInteger) c).getIntValue();
    } else if (c instanceof ConstantFloat) {
      value = ((ConstantFloat) c).getValue();
    } else if (c instanceof ConstantDouble) {
View Full Code Here


   * an aload_0 is used to load the uninitialized object (as an example see the ctors in grails.util.BuildSettings).
   *
   * @return true if managed to remove them
   */
  private boolean deleteNewAndDup() {
    final ConstantPool cpool = getEnclosingClass().getConstantPool();
    int depth = 1;
    InstructionHandle ih = range.getStart();

    // Go back from where we are looking for 'NEW' that takes us to a stack depth of 0. INVOKESPECIAL <init>
    while (ih != null) {
View Full Code Here

    if (!munger.getDeclaringType().isAnnotationStyleAspect()) {
      String proceedName = NameMangler.proceedMethodName(munger.getSignature().getName());

      InstructionHandle curr = localAdviceMethod.getBody().getStart();
      InstructionHandle end = localAdviceMethod.getBody().getEnd();
      ConstantPool cpg = localAdviceMethod.getEnclosingClass().getConstantPool();
      while (curr != end) {
        InstructionHandle next = curr.getNext();
        Instruction inst = curr.getInstruction();
        if ((inst.opcode == Constants.INVOKESTATIC) && proceedName.equals(((InvokeInstruction) inst).getMethodName(cpg))) {

          localAdviceMethod.getBody().append(curr,
              getRedoneProceedCall(fact, extractedShadowMethod, munger, localAdviceMethod, proceedVarList));
          Utility.deleteInstruction(curr, localAdviceMethod);
        }
        curr = next;
      }
      // and that's it.
    } else {
      // ATAJ inlining support for @AJ aspects
      // [TODO document @AJ code rule: don't manipulate 2 jps proceed at the same time.. in an advice body]
      InstructionHandle curr = localAdviceMethod.getBody().getStart();
      InstructionHandle end = localAdviceMethod.getBody().getEnd();
      ConstantPool cpg = localAdviceMethod.getEnclosingClass().getConstantPool();
      while (curr != end) {
        InstructionHandle next = curr.getNext();
        Instruction inst = curr.getInstruction();
        if ((inst instanceof INVOKEINTERFACE) && "proceed".equals(((INVOKEINTERFACE) inst).getMethodName(cpg))) {
          final boolean isProceedWithArgs;
View Full Code Here

      // is happening in an inner class so we don't inline it.
      // Note: for code style, this is done at Aspect compilation time.
      boolean canSeeProceedPassedToOther = false;
      InstructionHandle curr = adviceMethod.getBody().getStart();
      InstructionHandle end = adviceMethod.getBody().getEnd();
      ConstantPool cpg = adviceMethod.getEnclosingClass().getConstantPool();
      while (curr != end) {
        InstructionHandle next = curr.getNext();
        Instruction inst = curr.getInstruction();
        if ((inst instanceof InvokeInstruction)
            && ((InvokeInstruction) inst).getSignature(cpg).indexOf("Lorg/aspectj/lang/ProceedingJoinPoint;") > 0) {
View Full Code Here

      }
    }
  }

  public ClassGen(String classname, String superclassname, String filename, int modifiers, String[] interfacenames) {
    this(classname, superclassname, filename, modifiers, interfacenames, new ConstantPool());
  }
View Full Code Here

      attributes.addAll(Utility.getAnnotationAttributes(cpool, annotationsList));
      attributes.addAll(attributesList);
    }

    // Must be last since the above calls may still add something to it
    ConstantPool cp = this.cpool.getFinalConstantPool();

    return new JavaClass(classnameIndex, superclassnameIndex, filename, major, minor, modifiers, cp, interfaces, fields,
        methods, attributes.toArray(new Attribute[attributes.size()]));// OPTIMIZE avoid toArray()?
  }
View Full Code Here

      if (enclosingClass.getWorld().isInJava5Mode()) {
        gen.setModifiers(gen.getModifiers() | ACC_SYNTHETIC);
      }
      // belt and braces, do the attribute even on Java 5 in addition to
      // the modifier flag
      ConstantPool cpg = gen.getConstantPool();
      int index = cpg.addUtf8("Synthetic");
      gen.addAttribute(new Synthetic(index, 0, new byte[0], cpg));
    }

    if (hasBody()) {
      if (this.enclosingClass.getWorld().shouldFastPackMethods()) {
View Full Code Here

      if (enclosingClass.getWorld().isInJava5Mode()) {
        gen.setModifiers(gen.getModifiers() | ACC_SYNTHETIC);
      }
      // belt and braces, do the attribute even on Java 5 in addition to
      // the modifier flag
      ConstantPool cpg = gen.getConstantPool();
      int index = cpg.addUtf8("Synthetic");
      gen.addAttribute(new Synthetic(index, 0, new byte[0], cpg));
    }

    if (hasBody()) {
      if (this.enclosingClass.getWorld().shouldFastPackMethods()) {
View Full Code Here

  void deleteSourceObjectType(UnresolvedType ty) {
    typeMap.remove(ty.getSignature());
  }

  public static Member makeFieldJoinPointSignature(LazyClassGen cg, FieldInstruction fi) {
    ConstantPool cpg = cg.getConstantPool();
    return MemberImpl.field(fi.getClassName(cpg),
        (fi.opcode == Constants.GETSTATIC || fi.opcode == Constants.PUTSTATIC) ? Modifier.STATIC : 0, fi.getName(cpg), fi
            .getSignature(cpg));
  }
View Full Code Here

    return MemberImpl.monitorExit();
  }

  public Member makeJoinPointSignatureForArrayConstruction(LazyClassGen cg, InstructionHandle handle) {
    Instruction i = handle.getInstruction();
    ConstantPool cpg = cg.getConstantPool();
    Member retval = null;

    if (i.opcode == Constants.ANEWARRAY) {
      // ANEWARRAY arrayInstruction = (ANEWARRAY)i;
      Type ot = i.getType(cpg);
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.classfile.ConstantPool

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.