Package org.aspectj.apache.bcel.generic

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


        il.append(Utility.createGet(factory, AjcMemberMaker.perSingletonField(aspectType)));
        BranchInstruction ifNotNull = InstructionFactory.createBranchInstruction(Constants.IFNONNULL, null);
        il.append(ifNotNull);
        il.append(factory.createNew(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION.getName()));
        il.append(InstructionConstants.DUP);
        il.append(new PUSH(classGen.getConstantPoolGen(), aspectType.getName()));
        il.append(Utility.createGet(factory, AjcMemberMaker.initFailureCauseField(aspectType)));
        il.append(factory.createInvoke(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION.getName(), "<init>", Type.VOID, new Type[] { Type.STRING, new ObjectType("java.lang.Throwable") }, Constants.INVOKESPECIAL));
        il.append(InstructionConstants.ATHROW);
        InstructionHandle ifElse = il.append(Utility.createGet(factory, AjcMemberMaker.perSingletonField(aspectType)));
        il.append(InstructionFactory.createReturn(Type.OBJECT));
View Full Code Here


        InstructionList il = method.getBody();
        il.append(Utility.createGet(factory, AjcMemberMaker.perSingletonField(aspectType)));
        BranchInstruction ifNull = InstructionFactory.createBranchInstruction(Constants.IFNULL, null);
        il.append(ifNull);
        il.append(new PUSH(classGen.getConstantPoolGen(), true));
        il.append(InstructionFactory.createReturn(Type.INT));
        InstructionHandle ifElse = il.append(new PUSH(classGen.getConstantPoolGen(), false));
        il.append(InstructionFactory.createReturn(Type.INT));
        ifNull.setTarget(ifElse);
    }
View Full Code Here

        il.append(InstructionConstants.ALOAD_1);
        BranchInstruction ifNonNull = InstructionFactory.createBranchInstruction(Constants.IFNONNULL, null);
        il.append(ifNonNull);
        il.append(factory.createNew(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION.getName()));
        il.append(InstructionConstants.DUP);
        il.append(new PUSH(classGen.getConstantPoolGen(), aspectType.getName()));
        il.append(InstructionConstants.ACONST_NULL);
        il.append(factory.createInvoke(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION.getName(), "<init>", Type.VOID, new Type[] { Type.STRING, new ObjectType("java.lang.Throwable") }, Constants.INVOKESPECIAL));
        il.append(InstructionConstants.ATHROW);
        InstructionHandle ifElse = il.append(InstructionConstants.ALOAD_1);
        ifNonNull.setTarget(ifElse);
View Full Code Here

        flagAsSynthetic(method, true);
        classGen.addMethodGen(method);

        InstructionList il = method.getBody();
        InstructionHandle tryStart = il.append(InstructionConstants.ALOAD_0);
        il.append(new PUSH(factory.getConstantPool(), NameMangler.perTypeWithinLocalAspectOf(aspectType)));
        il.append(InstructionConstants.ACONST_NULL);//Class[] for "getDeclaredMethod"
        il.append(factory.createInvoke(
                "java/lang/Class",
                "getDeclaredMethod",
                Type.getType("Ljava/lang/reflect/Method;"),
View Full Code Here

   
    BcelWorld.getBcelObjectType(munger.getConcreteAspect());
    String aspectname = munger.getConcreteAspect().getName();
   
    String ptwField = NameMangler.perTypeWithinFieldForTarget(munger.getConcreteAspect());
    entrySuccessInstructions.append(new PUSH(fact.getConstantPool(),t.getName()));
   
    entrySuccessInstructions.append(fact.createInvoke(aspectname,"ajc$createAspectInstance",new ObjectType(aspectname),
        new Type[]{new ObjectType("java.lang.String")},Constants.INVOKESTATIC));
    entrySuccessInstructions.append(fact.createPutStatic(t.getName(),ptwField,
        new ObjectType(aspectname)));
View Full Code Here

     
      // make a new factory
      list.append(fact.createNew(factoryType));
      list.append(InstructionFactory.createDup(1));
     
      list.append(new PUSH(getConstantPoolGen(), getFileName()));
     
      // load the current Class object
      //XXX check that this works correctly for inners/anonymous
      list.append(new PUSH(getConstantPoolGen(), getClassName()));
      //XXX do we need to worry about the fact the theorectically this could throw
      //a ClassNotFoundException
      list.append(fact.createInvoke("java.lang.Class", "forName", classType,
            new Type[] {Type.STRING}, Constants.INVOKESTATIC));
     
View Full Code Here

     
      // load the factory
      list.append(InstructionFactory.createLoad(factoryType, 0));
     
      // load the kind
      list.append(new PUSH(getConstantPoolGen(), shadow.getKind().getName()));
     
      // create the signature
      list.append(InstructionFactory.createLoad(factoryType, 0));
     
      if (world.isTargettingAspectJRuntime12()) { // TAG:SUPPORTING12: We didn't have optimized factory methods in 1.2
          list.append(new PUSH(getConstantPoolGen(), sig.getSignatureString(shadow.getWorld())));
        list.append(fact.createInvoke(factoryType.getClassName(),
              sig.getSignatureMakerName(),
              new ObjectType(sig.getSignatureType()),
              new Type[] { Type.STRING },
              Constants.INVOKEVIRTUAL));
      } else   if (sig.getKind().equals(Member.METHOD)) {
        BcelWorld w = shadow.getWorld();
        // For methods, push the parts of the signature on.
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getModifiers(w))));
        list.append(new PUSH(getConstantPoolGen(),sig.getName()));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getDeclaringType())));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getParameterTypes())));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getParameterNames(w))));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getExceptions(w))));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getReturnType())));
        // And generate a call to the variant of makeMethodSig() that takes 7 strings
        list.append(fact.createInvoke(factoryType.getClassName(),
            sig.getSignatureMakerName(),
            new ObjectType(sig.getSignatureType()),
            new Type[] { Type.STRING,Type.STRING,Type.STRING,Type.STRING,Type.STRING,Type.STRING,Type.STRING },
            Constants.INVOKEVIRTUAL));
      } else if (sig.getKind().equals(Member.HANDLER)) {
        BcelWorld w = shadow.getWorld();
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getDeclaringType())));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getParameterTypes())));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getParameterNames(w))));
        list.append(fact.createInvoke(factoryType.getClassName(),
            sig.getSignatureMakerName(),
            new ObjectType(sig.getSignatureType()),
            new Type[] { Type.STRING, Type.STRING, Type.STRING },
            Constants.INVOKEVIRTUAL));     
      } else if(sig.getKind().equals(Member.CONSTRUCTOR)) {
        BcelWorld w = shadow.getWorld();
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getModifiers(w))))
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getDeclaringType())));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getParameterTypes())));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getParameterNames(w))));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getExceptions(w))));
        list.append(fact.createInvoke(factoryType.getClassName(),
            sig.getSignatureMakerName(),
            new ObjectType(sig.getSignatureType()),
            new Type[] { Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING },
            Constants.INVOKEVIRTUAL));     
      } else if(sig.getKind().equals(Member.FIELD)) {
        BcelWorld w = shadow.getWorld();
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getModifiers(w))));
        list.append(new PUSH(getConstantPoolGen(),sig.getName()));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getDeclaringType())));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getReturnType())));
        list.append(fact.createInvoke(factoryType.getClassName(),
            sig.getSignatureMakerName(),
            new ObjectType(sig.getSignatureType()),
            new Type[] { Type.STRING, Type.STRING, Type.STRING, Type.STRING },
            Constants.INVOKEVIRTUAL));     
      } else if(sig.getKind().equals(Member.ADVICE)) {
        BcelWorld w = shadow.getWorld();
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getModifiers(w))));
        list.append(new PUSH(getConstantPoolGen(),sig.getName()));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getDeclaringType())));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getParameterTypes())));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getParameterNames(w))));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getExceptions(w))));
        list.append(new PUSH(getConstantPoolGen(),makeString((sig.getReturnType()))));       
        list.append(fact.createInvoke(factoryType.getClassName(),
            sig.getSignatureMakerName(),
            new ObjectType(sig.getSignatureType()),
            new Type[] { Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING },
            Constants.INVOKEVIRTUAL));     
      } else if(sig.getKind().equals(Member.STATIC_INITIALIZATION)) {
        BcelWorld w = shadow.getWorld();
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getModifiers(w))));
        list.append(new PUSH(getConstantPoolGen(),makeString(sig.getDeclaringType())));
        list.append(fact.createInvoke(factoryType.getClassName(),
            sig.getSignatureMakerName(),
            new ObjectType(sig.getSignatureType()),
            new Type[] { Type.STRING, Type.STRING },
            Constants.INVOKEVIRTUAL));
      } else {
        list.append(new PUSH(getConstantPoolGen(), sig.getSignatureString(shadow.getWorld())));
        list.append(fact.createInvoke(factoryType.getClassName(),
             sig.getSignatureMakerName(),
             new ObjectType(sig.getSignatureType()),
             new Type[] { Type.STRING },
             Constants.INVOKEVIRTUAL));
View Full Code Here

TOP

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

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.