Package org.aspectj.apache.bcel.generic

Examples of org.aspectj.apache.bcel.generic.InstructionFactory$MethodObject


    if (inlineAccessor == null) {
      // add static method to aspect
      inlineAccessor = AjcMemberMaker.inlineAccessMethodForMethod(aspectType, resolvedMember);

      // add new accessor method to aspect bytecode
      InstructionFactory factory = m_aspectGen.getFactory();
      LazyMethodGen method = makeMethodGen(m_aspectGen, inlineAccessor);
      // flag it synthetic, AjSynthetic
      method.makeSynthetic();
      List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>();
      methodAttributes.add(new AjAttribute.AjSynthetic());
View Full Code Here


    if (inlineAccessor == null) {
      // add super accessor method to class:
      inlineAccessor = AjcMemberMaker.superAccessMethod(aspectType, resolvedMember);

      // add new accessor method to aspect bytecode
      InstructionFactory factory = m_aspectGen.getFactory();
      LazyMethodGen method = makeMethodGen(m_aspectGen, inlineAccessor);
      // flag it synthetic, AjSynthetic
      method.makeSynthetic();
      List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>();
      methodAttributes.add(new AjAttribute.AjSynthetic());
View Full Code Here

    if (inlineAccessor == null) {
      // add static method to aspect
      inlineAccessor = AjcMemberMaker.inlineAccessMethodForFieldGet(aspectType, resolvedMember);

      // add new accessor method to aspect bytecode
      InstructionFactory factory = m_aspectGen.getFactory();
      LazyMethodGen method = makeMethodGen(m_aspectGen, inlineAccessor);
      // flag it synthetic, AjSynthetic
      method.makeSynthetic();
      List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>();
      methodAttributes.add(new AjAttribute.AjSynthetic());
View Full Code Here

    if (inlineAccessor == null) {
      // add static method to aspect
      inlineAccessor = AjcMemberMaker.inlineAccessMethodForFieldSet(aspectType, resolvedMember);

      // add new accessor method to aspect bytecode
      InstructionFactory factory = m_aspectGen.getFactory();
      LazyMethodGen method = makeMethodGen(m_aspectGen, inlineAccessor);
      // flag it synthetic, AjSynthetic
      method.makeSynthetic();
      List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>();
      methodAttributes.add(new AjAttribute.AjSynthetic());
View Full Code Here

   * @param extraArgVar The var that will hold the return value or thrown exception for afterX advice
   * @param ifNoAdvice The instructionHandle to jump to if the dynamic tests for this munger fails.
   */
  InstructionList getAdviceInstructions(BcelShadow s, BcelVar extraArgVar, InstructionHandle ifNoAdvice) {
    BcelShadow shadow = s;
    InstructionFactory fact = shadow.getFactory();
    BcelWorld world = shadow.getWorld();

    InstructionList il = new InstructionList();

    // we test to see if we have the right kind of thing...
View Full Code Here

    return il;
  }

  public InstructionList getAdviceArgSetup(BcelShadow shadow, BcelVar extraVar, InstructionList closureInstantiation) {
    InstructionFactory fact = shadow.getFactory();
    BcelWorld world = shadow.getWorld();
    InstructionList il = new InstructionList();

    // if (targetAspectField != null) {
    // il.append(fact.createFieldAccess(
View Full Code Here

  }

  private void addFieldGetter(LazyClassGen gen, ResolvedMember field, ResolvedMember accessMethod) {
    LazyMethodGen mg = makeMethodGen(gen, accessMethod);
    InstructionList il = new InstructionList();
    InstructionFactory fact = gen.getFactory();
    if (Modifier.isStatic(field.getModifiers())) {
      il.append(fact.createFieldAccess(gen.getClassName(), field.getName(), BcelWorld.makeBcelType(field.getType()),
          Constants.GETSTATIC));
    } else {
      il.append(InstructionConstants.ALOAD_0);
      il.append(fact.createFieldAccess(gen.getClassName(), field.getName(), BcelWorld.makeBcelType(field.getType()),
          Constants.GETFIELD));
    }
    il.append(InstructionFactory.createReturn(BcelWorld.makeBcelType(field.getType())));
    mg.getBody().insert(il);
View Full Code Here

  }

  private void addFieldSetter(LazyClassGen gen, ResolvedMember field, ResolvedMember accessMethod) {
    LazyMethodGen mg = makeMethodGen(gen, accessMethod);
    InstructionList il = new InstructionList();
    InstructionFactory fact = gen.getFactory();
    Type fieldType = BcelWorld.makeBcelType(field.getType());

    if (Modifier.isStatic(field.getModifiers())) {
      il.append(InstructionFactory.createLoad(fieldType, 0));
      il.append(fact.createFieldAccess(gen.getClassName(), field.getName(), fieldType, Constants.PUTSTATIC));
    } else {
      il.append(InstructionConstants.ALOAD_0);
      il.append(InstructionFactory.createLoad(fieldType, 1));
      il.append(fact.createFieldAccess(gen.getClassName(), field.getName(), fieldType, Constants.PUTFIELD));
    }
    il.append(InstructionFactory.createReturn(Type.VOID));
    mg.getBody().insert(il);

    gen.addMethodGen(mg, getSignature().getSourceLocation());
View Full Code Here

  }

  private void addMethodDispatch(LazyClassGen gen, ResolvedMember method, ResolvedMember accessMethod) {
    LazyMethodGen mg = makeMethodGen(gen, accessMethod);
    InstructionList il = new InstructionList();
    InstructionFactory fact = gen.getFactory();
    // Type fieldType = BcelWorld.makeBcelType(field.getType());
    Type[] paramTypes = BcelWorld.makeBcelTypes(method.getParameterTypes());

    int pos = 0;
View Full Code Here

      Type fieldType = BcelWorld.makeBcelType(aspectType);
      LazyMethodGen mg = new LazyMethodGen(Modifier.PUBLIC, fieldType, NameMangler.perObjectInterfaceGet(aspectType),
          new Type[0], new String[0], gen);
      InstructionList il = new InstructionList();
      InstructionFactory fact = gen.getFactory();
      il.append(InstructionConstants.ALOAD_0);
      il.append(fact.createFieldAccess(gen.getClassName(), fg.getName(), fieldType, Constants.GETFIELD));
      il.append(InstructionFactory.createReturn(fieldType));
      mg.getBody().insert(il);

      gen.addMethodGen(mg);

      LazyMethodGen mg1 = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, NameMangler.perObjectInterfaceSet(aspectType),

      new Type[] { fieldType, }, new String[0], gen);
      InstructionList il1 = new InstructionList();
      il1.append(InstructionConstants.ALOAD_0);
      il1.append(InstructionFactory.createLoad(fieldType, 1));
      il1.append(fact.createFieldAccess(gen.getClassName(), fg.getName(), fieldType, Constants.PUTFIELD));
      il1.append(InstructionFactory.createReturn(Type.VOID));
      mg1.getBody().insert(il1);

      gen.addMethodGen(mg1);
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.generic.InstructionFactory$MethodObject

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.