Package org.aspectj.apache.bcel.generic

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


        Range.genEnd(body));
    }
  }

  private boolean isThisCall(InstructionHandle ih) {
    INVOKESPECIAL inst = (INVOKESPECIAL) ih.getInstruction();
    return inst.getClassName(cpg).equals(clazz.getName());
  }
View Full Code Here


            InstructionList insList = aMethod.getBody();
            InstructionHandle handle = insList.getStart();
            while (handle!= null) {
              if (handle.getInstruction() instanceof INVOKESPECIAL) {
                ConstantPoolGen cpg = newParentTarget.getConstantPoolGen();
                INVOKESPECIAL invokeSpecial = (INVOKESPECIAL)handle.getInstruction();
                if (invokeSpecial.getClassName(cpg).equals(currentParent) && invokeSpecial.getMethodName(cpg).equals("<init>")) {
                  // System.err.println("Transforming super call '<init>"+sp.getSignature(cpg)+"'");
                    
                  // 1. Check there is a ctor in the new parent with the same signature
                  ResolvedMember newCtor = getConstructorWithSignature(newParent,invokeSpecial.getSignature(cpg));
                       
                  if (newCtor == null) {
                               
                                // 2. Check ITDCs to see if the necessary ctor is provided that way
                                boolean satisfiedByITDC = false;
                                for (Iterator ii = newParentTarget.getType().getInterTypeMungersIncludingSupers().iterator(); ii.hasNext() && !satisfiedByITDC; ) {
                                    ConcreteTypeMunger m = (ConcreteTypeMunger)ii.next();
                                    if (m.getMunger() instanceof NewConstructorTypeMunger) {
                                        if (m.getSignature().getSignature().equals(invokeSpecial.getSignature(cpg))) {
                                            satisfiedByITDC = true;
                                        }
                                    }
                                }
                               
                                if (!satisfiedByITDC) {
                      String csig = createReadableCtorSig(newParent, cpg, invokeSpecial);
                      weaver.getWorld().getMessageHandler().handleMessage(MessageUtil.error(
                        "Unable to modify hierarchy for "+newParentTarget.getClassName()+" - the constructor "+
                    csig+" is missing",this.getSourceLocation()));
                      return false;
                                }
                  }
                    
                  int idx = cpg.addMethodref(newParent.getName(), invokeSpecial.getMethodName(cpg), invokeSpecial.getSignature(cpg));
                  invokeSpecial.setIndex(idx);
                }
              }
              handle = handle.getNext();  
            }
          }
View Full Code Here

TOP

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

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.