Package org.aspectj.apache.bcel.classfile

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


      // INVOKEVIRTUAL is an InvokeInstruction, the argument and return types are resolved/verified,
      // too. So are the allowed method names.
      String classname = o.getClassName(cpg);
      JavaClass jc = Repository.lookupClass(classname);
      Method[] ms = jc.getMethods();
      Method m = null;
      for (int i=0; i<ms.length; i++){
        if ( (ms[i].getName().equals(o.getMethodName(cpg))) &&
             (Type.getReturnType(ms[i].getSignature()).equals(o.getReturnType(cpg))) &&
             (objarrayequals(Type.getArgumentTypes(ms[i].getSignature()), o.getArgumentTypes(cpg))) ){
          m = ms[i];
View Full Code Here


        // code style pointcuts are class attributes
        // we need to gather the @AJ pointcut right now and not at method level annotation extraction time
        // in order to be able to resolve the pointcut references later on
        // we don't need to look in super class, the pointcut reference in the grammar will do it
        for (int i = 0; i < javaClass.getMethods().length; i++) {
            Method method = javaClass.getMethods()[i];
            if (method.getName().startsWith(NameMangler.PREFIX)) continue// already dealt with by ajc...
            //FIXME alex optimize, this method struct will gets recreated for advice extraction
            AjAttributeMethodStruct mstruct = new AjAttributeMethodStruct(method, null, type, context, msgHandler);//FIXME AVASM
            Attribute[] mattributes = method.getAttributes();

            for (int j = 0; j < mattributes.length; j++) {
                Attribute mattribute = mattributes[j];
                if (acceptAttribute(mattribute)) {
                    RuntimeAnnotations mrvs = (RuntimeAnnotations) mattribute;
View Full Code Here

     * @param struct
     * @return null if no debug info is available
     */
    private static FormalBinding[] extractBindings(AjAttributeMethodStruct struct)
            throws UnreadableDebugInfoException {
        Method method = struct.method;
        String[] argumentNames = struct.getArgumentNames();

        // assert debug info was here
        if (argumentNames.length != method.getArgumentTypes().length) {
            reportError("Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '<javac debug='true'.../>' in Ant)", struct);
            throw new UnreadableDebugInfoException();
        }

        List bindings = new ArrayList();
        for (int i = 0; i < argumentNames.length; i++) {
            String argumentName = argumentNames[i];
            UnresolvedType argumentType = UnresolvedType.forSignature(method.getArgumentTypes()[i].getSignature());

            // do not bind JoinPoint / StaticJoinPoint / EnclosingStaticJoinPoint
            // TODO solve me : this means that the JP/SJP/ESJP cannot appear as binding
            // f.e. when applying advice on advice etc
            if ((AjcMemberMaker.TYPEX_JOINPOINT.equals(argumentType)
View Full Code Here

    ExceptionTable et = null;
   
    if(throws_vec.size() > 0)
      addAttribute(et = getExceptionTable(cp)); // Add `Exceptions' if there are "throws" clauses

    Method m = new Method(access_flags, name_index, signature_index,
        getAttributes(), cp.getConstantPool());

    // Undo effects of adding attributes
    if(lvt != nullremoveCodeAttribute(lvt);
    if(lnt != nullremoveCodeAttribute(lnt);
View Full Code Here

  }

  /** @return deep copy of this method
   */
  public MethodGen copy(String class_name, ConstantPoolGen cp) {
    Method    m  = ((MethodGen)clone()).getMethod();
    MethodGen mg = new MethodGen(m, class_name, this.cp);

    if(this.cp != cp) {
      mg.setConstantPool(cp);
      mg.getInstructionList().replaceConstantPool(this.cp, cp);
View Full Code Here

    }
    for(int i=0; i < annotations.length; i++)
        addAnnotation(annotations[i]);

    for(int i=0; i < methods.length; i++) {
      Method m = methods[i];
        addMethod(m);
    }

    for(int i=0; i < fields.length; i++)
      addField(fields[i]);
View Full Code Here

  /** @return method object with given name and signature, or null
   */
  public Method containsMethod(String name, String signature) {
    for(Iterator e=method_vec.iterator(); e.hasNext();) {
      Method m = (Method)e.next();
      if(m.getName().equals(name) && m.getSignature().equals(signature))
  return m;
    }

    return null;
  }
View Full Code Here

TOP

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

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.