Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.Method


            while (true) {
                c = c.getSuperClass();
                if (c == null) {
                    return null;
                }
                Method m = findImplementation(c, name, signature);
                if (m != null && !m.isAbstract()) {
                    return c;
                }

            }
        } catch (ClassNotFoundException e) {
View Full Code Here


            while (true) {
                c = c.getSuperClass();
                if (c == null) {
                    return null;
                }
                Method m = findImplementation(c, name, signature);
                if (m != null && !m.isAbstract()) {
                    return XFactory.createXMethod(c, m);
                }

            }
        } catch (ClassNotFoundException e) {
View Full Code Here

    public static @CheckForNull
    JavaClass findImplementor(JavaClass[] clazz, String name, String signature) {

        for (JavaClass aClazz : clazz) {
            Method m = findImplementation(aClazz, name, signature);
            if (m != null && !m.isAbstract()) {
                return aClazz;
            }

        }
        return null;
View Full Code Here

     *
     * @param node
     *            the CallGraphNode for the method to be scanned
     */
    private void scan(CallGraphNode node) throws CFGBuilderException {
        Method method = node.getMethod();
        CFG cfg = classContext.getCFG(method);

        if (method.isSynchronized()) {
            hasSynchronization = true;
        }

        Iterator<BasicBlock> i = cfg.blockIterator();
        while (i.hasNext()) {
            BasicBlock block = i.next();
            Iterator<InstructionHandle> j = block.instructionIterator();
            while (j.hasNext()) {
                InstructionHandle handle = j.next();

                Instruction ins = handle.getInstruction();
                if (ins instanceof InvokeInstruction) {
                    InvokeInstruction inv = (InvokeInstruction) ins;
                    Method called = isSelfCall(inv);
                    if (called != null) {
                        // Add edge to call graph
                        CallSite callSite = new CallSite(method, block, handle);
                        callGraph.createEdge(node, callGraph.getNodeForMethod(called), callSite);

View Full Code Here

  ConstantPoolGen cp      = new ConstantPoolGen(java_class.getConstantPool());
     Method[]        methods = java_class.getMethods();
 
  for(int j = 0; j < methods.length; j++) {
    Method    m  = methods[j];

    if(!(m.isAbstract() || m.isNative())) {
      MethodGen mg = new MethodGen(m, argv[i], cp);

      int compiled_stack  = mg.getMaxStack();
      int compiled_locals = mg.getMaxLocals();
      mg.setMaxStack(); // Recompute value
View Full Code Here

      for(int i=0; i < methods.length; i++) {
  if(!(methods[i].isAbstract() || methods[i].isNative())) {
    MethodGen mg       = new MethodGen(methods[i],
               clazz.getClassName(), cp);
    Method    stripped = removeNOPs(mg);
   
    if(stripped != null) {
        methods[i] = stripped; // Overwrite with stripped method
    }
  }
View Full Code Here

    }
  }
      }
    }

    Method m = null;
   
    if(count > 0) {
      System.out.println("Removed " + count + " NOP instructions from method " +
       mg.getName());
      m = mg.getMethod();
View Full Code Here

        for (ProgramPoint p : calledFrom) {
            XMethod upcall = getConstructorThatCallsSuperConstructor(p.method);
            if (upcall == null) {
                continue;
            }
            Method upcallMethod = null;
            for (Method m : getThisClass().getMethods()) {
                if (m.getName().equals(upcall.getName()) && m.getSignature().equals(upcall.getSignature())) {
                    upcallMethod = m;
                    break;
                }
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

            null, cpg.getConstantPool()));
    dups.add(varRef);
      }
  }

  Method init = compileInit(sortObjects, sortRecord,
           cpg, className);
  Method extract = compileExtract(sortObjects, sortRecord,
          cpg, className);
  sortRecord.addMethod(init);
  sortRecord.addMethod(extract);

  xsltc.dumpClass(sortRecord.getJavaClass());
View Full Code Here

TOP

Related Classes of org.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.