Package org.candle.decompiler.ast

Examples of org.candle.decompiler.ast.MethodBlock


    IntermediateGraphTransformer igt = new IntermediateGraphTransformer(igc);
    IntermediateGraphContext interGraphContext = igt.getIntermediateGraphContext();
    processIntermediate(interGraphContext);
   
    MethodBlock method = extractMethodSignature(methodGenerator);
    BlockVisitor iv = new BlockVisitor(interGraphContext, method);
    iv.process();
   
    classBlock.addChild(method);
    method.setParent(classBlock);
  }
View Full Code Here


    LOG.debug("End Instruction Graph ======");
  }

  protected MethodBlock extractMethodSignature(MethodGen methodGen) {
   
    MethodBlock mb = null;
    boolean isConstructor = false;
   
   
        ConstantPoolGen cpg = methodGen.getConstantPool();
        LocalVariableTable lvt = methodGen.getLocalVariableTable(cpg);
       
    String access = Utility.accessToString(methodGen.getAccessFlags());
    String signature = Type.getMethodSignature(methodGen.getType(), methodGen.getArgumentTypes());
       
        String name = methodGen.getName();
        if(StringUtils.equals(name, Constants.CONSTRUCTOR_NAME)) {
          name = StringUtils.substringAfterLast(methodGen.getClassName(), ".");
          isConstructor = true;
        }
       
        if(StringUtils.equals(methodGen.getName(), Constants.STATIC_INITIALIZER_NAME)) {
          signature = "static ";
        }
        else {
          signature = org.apache.bcel.classfile.Utility.methodSignatureToString(signature, name, access, true, lvt);
        }
       
        StringBuilder builder = new StringBuilder(signature);
        if (methodGen.getExceptions().length > 0) {
            for (String excep : methodGen.getExceptions()) {
                builder.append(" throws ").append(excep);
            }
        }
       
        if(isConstructor){
          mb = new ConstructorBlock(builder.toString(), methodGen.getInstructionList().getEnd().getPosition());
        }
        else {
            mb = new MethodBlock(builder.toString(), methodGen.getInstructionList().getEnd().getPosition());
        }
       
        return mb;
  }
View Full Code Here

TOP

Related Classes of org.candle.decompiler.ast.MethodBlock

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.