Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.MethodGen


            ConstantPoolGen constantPoolGen, InstructionFactory instructionFactory)
    {
        InstructionList il = new InstructionList();

        String methodName = "getDefault";
        MethodGen mg = new MethodGen(ACC_STATIC | ACC_PUBLIC, // access flags
                            Type.getType(SSLSocketFactory.class)// return type
                            new Type[0],   // argument types - no args
                            new String[0], // arg names - no args
                            methodName,
                            classGen.getClassName(),    // method, class
                            il,
                            constantPoolGen);

        il.append(instructionFactory.createNew(classGen.getClassName()));
        il.append(InstructionConstants.DUP);

        il.append(instructionFactory.createInvoke(classGen.getClassName(), "<init>", Type.VOID,
                                       new Type[] {},
                                       Constants.INVOKESPECIAL));

        il.append(InstructionConstants.ARETURN);

        mg.setMaxStack();
        classGen.addMethod(mg.getMethod());
        il.dispose();
    }
View Full Code Here


   
  }

  @Override
  public void visitMethod(Method obj) {
    MethodGen methodGenerator = new MethodGen(obj, this.javaClass.getClassName(), this.constantPool);
   
    LOG.debug("Processing MethodInvocation: "+methodGenerator.toString());
    IntermediateContext intermediateContext = new IntermediateContext(this.javaClass, methodGenerator);
   
    InstructionList instructions = methodGenerator.getInstructionList();
    instructions.setPositions(true);
   
    InstructionGraphFactory igf = new InstructionGraphFactory(instructions, methodGenerator.getExceptionHandlers());
    InstructionGraphContext igc = igf.process();
   
   
    List<InstructionGraphEnhancer> iges = new ArrayList<InstructionGraphEnhancer>();
    iges.add(new InstructionGraphWriter(igc, "before.dot"));
    iges.add(new SplitInstructionEnhancer(igc));
    iges.add(new ConditionEdgeEnhancer(igc));
    iges.add(new ExceptionEdgeEnhancer(igc, methodGenerator.getExceptionHandlers()));
    iges.add(new InstructionToIntermediateEnhancer(igc, intermediateContext));
   
    iges.add(new BackEdgeEnhancer(igc));
    iges.add(new LoopHeader(igc));
    iges.add(new ContinuousLoop(igc));
View Full Code Here

    RSField pixelY = data.getProperField("PixelY");
        for (Entry<String, ClassGen> c : classes.entrySet()) {
            for (Method m : c.getValue().getMethods()) {
              ClassGen cg = new ClassGen(c.getValue().getJavaClass());
              ConstantPoolGen cpg = c.getValue().getConstantPool();
              MethodGen gen = new MethodGen(m, c.getValue().getClassName(), cpg);
              InstructionList list = gen.getInstructionList();
              if(list == null)
                continue;
              MethodSearcher mS = new MethodSearcher(m, cg, cpg);
              if(m.isStatic() && m.isFinal() && m.getReturnType().equals(Type.VOID) && m.getArgumentTypes().length == 6
                  && mS.hasField(myplayer.path))
        {
          InstructionList il = gen.getInstructionList();
                    if (il == null) {
                        continue;
                    }
                    String sDestX;
                    int count = 0;
View Full Code Here

          if(c.getValue().getClassName().equals("client"))
          {
              for (Method m : c.getValue().getMethods()) {
                  if (m.isStatic() && m.isFinal() && m.getReturnType().equals(Type.VOID) && m.getArgumentTypes().length == 10) {
                    ConstantPoolGen cpg = c.getValue().getConstantPool();
                      MethodGen gen = new MethodGen(m, c.getValue().getClassName(), cpg);
                      InstructionList il = gen.getInstructionList();
                      if (il == null) {
                          continue;
                      }
                      InstructionFinder f = new InstructionFinder(il);
                      Iterator e = f.search("INVOKESTATIC IFEQ GETSTATIC ICONST_2 IF_ICMPLE");
View Full Code Here

      ConstantPoolGen cpg = c.getValue().getConstantPool();
      for(Method m : c.getValue().getMethods()){
        MethodSearcher mS = new MethodSearcher(m, cg, cpg);
        if(m.isSynchronized() && m.isFinal() && m.getReturnType().equals(Type.VOID)
            && mS.getTypeCount("int[]") == 1){
          MethodGen mg = new MethodGen(m, c.getValue().getClassName(), cpg);
          InstructionList il = mg.getInstructionList();
          for(Instruction i : il.getInstructions()){
            if(i instanceof FieldInstruction){
              if(((FieldInstruction) i).getClassName(cpg).equals(nodeClass.className)){
                nodeClass.addField("Next", ((FieldInstruction) i).getFieldName(cpg));
                return ((FieldInstruction) i).getFieldName(cpg);
View Full Code Here

        for(Method m : c.getValue().getMethods()){
          MethodSearcher mS = new MethodSearcher(m, cg, cpg);
          if(m.getName().equals("<init>") && mS.getTypeCount(npc.className) == 1 &&
              mS.getArgCount() == 1){
            RSClass npcnode = data.addClass("NPCNode", c.getValue().getClassName());
            MethodGen mg = new MethodGen(m, cg.getClassName(), cpg);
            InstructionList il = mg.getInstructionList();
            InstructionSearcher iS = new InstructionSearcher(il, cpg);
            Instruction i = iS.nextPUTFIELD();
            npcnode.addField("GetNPC", ((PUTFIELD) i).getFieldName(cpg));
            return SearchResult.Success;
          }
View Full Code Here

    RSClass character = data.getProperClass("Character");
        for (Entry<String, ClassGen> c : classes.entrySet()) {
            for (Method m : c.getValue().getMethods()) {
              ClassGen cg = new ClassGen(c.getValue().getJavaClass());
              ConstantPoolGen cpg = c.getValue().getConstantPool();
                MethodGen gen = new MethodGen(m, c.getValue().getClassName(), cpg);
                MethodSearcher mS = new MethodSearcher(m, cg, cpg);
              if(m.isFinal() && m.isStatic() && m.getReturnType().equals(Type.VOID) &&
                  mS.getArgCount() == 4 && mS.getTypeCount(player.className) == 1){
                    InstructionList il = gen.getInstructionList();
                    if (il == null) {
                        continue;
                    }
                    InstructionSearcher2 iS = new InstructionSearcher2(cg, m);
                    while(iS.nextFieldInstruction() != null){
View Full Code Here

          if(c.getValue().getClassName().equals("client"))
          {
              for (Method m : c.getValue().getMethods()) {
                if(m.isFinal() && m.getReturnType().equals(Type.STRING)){
                      ConstantPoolGen cpg = c.getValue().getConstantPool();
                      MethodGen gen = new MethodGen(m, c.getValue().getClassName(), cpg);
                      InstructionList il = gen.getInstructionList();
                      if (il == null) {
                          continue;
                      }
                      InstructionList iList = gen.getInstructionList();
            InstructionSearcher iS = new InstructionSearcher(iList, cpg);
           
            if(iS.nextLDC("14)") != null){
              FieldInstruction fi = iS.nextFieldInstruction();
              data.addField("LoginIndex", fi.getClassName(cpg)+'.'+fi.getFieldName(cpg));
View Full Code Here

                !(cpg.lookupUtf8("microsoft") > 0) &&
                  !c.getValue().isAbstract()){
            for (Method m : c.getValue().getMethods()){
              MethodSearcher mS = new MethodSearcher(m, cg, cpg);
              if(mS.getTypeCount("java.awt.Canvas") >= 1 && m.getName().equals("<init>")){
                MethodGen mg = new MethodGen(m, c.getValue().getClassName(), cpg);
                InstructionList il = mg.getInstructionList();
                InstructionSearcher iS = new InstructionSearcher(il, cpg);
                Instruction i = iS.nextNEW();
                data.addClass("NodeList", ((NEW)i).getLoadClassType(cpg).getClassName());
                return(((NEW)i).getLoadClassType(cpg).getClassName());
              }
View Full Code Here

  public SearchResult run(RSClient data, HashMap<String, ClassGen> classes) {
        for (Entry<String, ClassGen> c : classes.entrySet()) {
          for (Method m : c.getValue().getMethods()) {
            ConstantPoolGen cpg = c.getValue().getConstantPool();
            ClassGen cg = new ClassGen(c.getValue().getJavaClass());
            MethodGen gen = new MethodGen(m, c.getValue().getClassName(), cpg);
              InstructionList il = gen.getInstructionList();
              if (il == null) {
                 continue;
              }
              InstructionSearcher iS = new InstructionSearcher(il, cpg);
            MethodSearcher mS = new MethodSearcher(m, cg, cpg);
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.MethodGen

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.