Package org.aspectj.apache.bcel.generic

Examples of org.aspectj.apache.bcel.generic.InstructionFactory.createNew()


    LazyMethodGen clinit = gen.getAjcPreClinit(); // StaticInitializer();
    InstructionList setup = new InstructionList();
    InstructionFactory fact = gen.getFactory();

    setup.append(fact.createNew(NameMangler.CFLOW_STACK_TYPE));
    setup.append(InstructionFactory.createDup(1));
    setup.append(fact.createInvoke(NameMangler.CFLOW_STACK_TYPE, "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));

    setup.append(Utility.createSet(fact, cflowStackField));
    clinit.getBody().insert(setup);
View Full Code Here


        }
        if (getKind() == ConstructorCall) {
          if (!world.isJoinpointArrayConstructionEnabled() || !this.getSignature().getDeclaringType().isArray()) {
            if (deletedNewAndDup) { // if didnt delete them, dont insert any!
              range.insert(InstructionFactory.createDup(1), Range.InsideBefore);
              range.insert(fact.createNew((ObjectType) BcelWorld.makeBcelType(getSignature().getDeclaringType())),
                  Range.InsideBefore);
            }
          }
        }
      }
View Full Code Here

    InstructionFactory fact = getFactory();
    InstructionList handler = new InstructionList();
    InstructionList rtExHandler = new InstructionList();
    BcelVar exceptionVar = genTempVar(catchType);

    handler.append(fact.createNew(NameMangler.SOFT_EXCEPTION_TYPE));
    handler.append(InstructionFactory.createDup(1));
    handler.append(exceptionVar.createLoad(fact));
    handler.append(fact.createInvoke(NameMangler.SOFT_EXCEPTION_TYPE, "<init>", Type.VOID, new Type[] { Type.THROWABLE },
        Constants.INVOKESPECIAL)); // ??? special
    handler.append(InstructionConstants.ATHROW);
View Full Code Here

    if (thisJoinPointVar != null) {
      arrayVar.appendConvertableArrayStore(il, fact, stateIndex, thisJoinPointVar);
      thisJoinPointVar.setPositionInAroundState(stateIndex);
      stateIndex++;
    }
    il.append(fact.createNew(new ObjectType(constructor.getDeclaringType().getName())));
    il.append(InstructionConstants.DUP);
    arrayVar.appendLoad(il, fact);
    il.append(Utility.createInvoke(fact, world, constructor));
    if (getKind() == PreInitialization) {
      il.append(InstructionConstants.DUP);
View Full Code Here

    InstructionList il = method.getBody();
    il.append(Utility.createGet(factory, AjcMemberMaker.perSingletonField(aspectType)));
    InstructionBranch 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(InstructionFactory.PUSH(classGen.getConstantPool(), 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));
View Full Code Here

    LazyMethodGen method = makeMethodGen(classGen, AjcMemberMaker.ajcPostClinitMethod(aspectType));
    flagAsSynthetic(method, true);
    classGen.addMethodGen(method);

    InstructionList il = method.getBody();
    il.append(factory.createNew(aspectType.getName()));
    il.append(InstructionConstants.DUP);
    il.append(factory.createInvoke(aspectType.getName(), "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
    il.append(Utility.createSet(factory, AjcMemberMaker.perSingletonField(aspectType)));
    il.append(InstructionFactory.createReturn(Type.VOID));
View Full Code Here

    InstructionBranch ifNull = InstructionFactory.createBranchInstruction(Constants.IFNULL, null);
    il.append(ifNull);
    il.append(InstructionFactory.createReturn(BcelWorld.makeBcelType(aspectType)));
    InstructionHandle ifNullElse = il.append(InstructionConstants.POP);
    ifNull.setTarget(ifNullElse);
    InstructionHandle ifEqElse = il.append(factory.createNew(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION.getName()));
    ifEq.setTarget(ifEqElse);
    il.append(InstructionConstants.DUP);
    il.append(factory.createInvoke(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION.getName(), "<init>", Type.VOID, Type.NO_ARGS,
        Constants.INVOKESPECIAL));
    il.append(InstructionConstants.ATHROW);
View Full Code Here

    il.append(Utility.createInvoke(factory, Constants.INVOKEINTERFACE, AjcMemberMaker.perObjectInterfaceGet(aspectType)));
    InstructionBranch ifNonNull = InstructionFactory.createBranchInstruction(Constants.IFNONNULL, null);
    il.append(ifNonNull);
    il.append(InstructionConstants.ALOAD_0);
    il.append(factory.createCheckCast(interfaceType));
    il.append(factory.createNew(aspectType.getName()));
    il.append(InstructionConstants.DUP);
    il.append(factory.createInvoke(aspectType.getName(), "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
    il.append(Utility.createInvoke(factory, Constants.INVOKEINTERFACE, AjcMemberMaker.perObjectInterfaceSet(aspectType)));
    InstructionHandle end = il.append(InstructionFactory.createReturn(Type.VOID));
    ifEq.setTarget(end);
View Full Code Here

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

    InstructionList il = method.getBody();
    il.append(Utility.createGet(factory, AjcMemberMaker.perCflowField(aspectType)));
    il.append(factory.createNew(aspectType.getName()));
    il.append(InstructionConstants.DUP);
    il.append(factory.createInvoke(aspectType.getName(), "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
    il.append(Utility.createInvoke(factory, Constants.INVOKEVIRTUAL, AjcMemberMaker.cflowStackPushInstance()));
    il.append(InstructionFactory.createReturn(Type.VOID));
  }
View Full Code Here

    InstructionFactory factory = classGen.getFactory();

    LazyMethodGen method = classGen.getAjcPreClinit(); // Creates a clinit if there isn't one

    InstructionList il = new InstructionList();
    il.append(factory.createNew(AjcMemberMaker.CFLOW_STACK_TYPE.getName()));
    il.append(InstructionConstants.DUP);
    il.append(factory.createInvoke(AjcMemberMaker.CFLOW_STACK_TYPE.getName(), "<init>", Type.VOID, Type.NO_ARGS,
        Constants.INVOKESPECIAL));
    il.append(Utility.createSet(factory, AjcMemberMaker.perCflowField(aspectType)));
    method.getBody().insert(il);
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.