Search in sources :

Example 11 with CodeExceptionGen

use of org.apache.bcel.generic.CodeExceptionGen in project jop by jop-devel.

the class MethodCode method getTargetingExceptionRanges.

public List<CodeExceptionGen> getTargetingExceptionRanges(InstructionHandle ih) {
    List<CodeExceptionGen> list = new ArrayList<CodeExceptionGen>();
    InstructionTargeter[] targeters = ih.getTargeters();
    if (targeters == null)
        return list;
    for (InstructionTargeter t : targeters) {
        if (t instanceof CodeExceptionGen) {
            CodeExceptionGen ceg = (CodeExceptionGen) t;
            if (ceg.getHandlerPC().equals(ih)) {
                list.add(ceg);
            }
        }
    }
    return list;
}
Also used : InstructionTargeter(org.apache.bcel.generic.InstructionTargeter) ArrayList(java.util.ArrayList) CodeExceptionGen(org.apache.bcel.generic.CodeExceptionGen)

Example 12 with CodeExceptionGen

use of org.apache.bcel.generic.CodeExceptionGen in project jop by jop-devel.

the class DescendingClassTraverser method visitMethodCode.

public void visitMethodCode(MethodInfo methodInfo) {
    if (methodInfo.hasCode()) {
        bcelVisitor.setCode(true);
        MethodCode code = methodInfo.getCode();
        visitor.visitMethodCode(code);
        for (CodeExceptionGen ex : code.getExceptionHandlers()) {
            visitor.visitCodeException(methodInfo, ex);
        }
        for (LineNumberGen lng : code.getLineNumbers()) {
            visitor.visitLineNumber(methodInfo, lng);
        }
        for (LocalVariableGen lvg : code.getLocalVariables()) {
            visitor.visitLocalVariable(methodInfo, lvg);
        }
        visitAttributes(code.getAttributes());
        bcelVisitor.setCode(false);
    }
}
Also used : LineNumberGen(org.apache.bcel.generic.LineNumberGen) LocalVariableGen(org.apache.bcel.generic.LocalVariableGen) MethodCode(com.jopdesign.common.MethodCode) CodeExceptionGen(org.apache.bcel.generic.CodeExceptionGen)

Aggregations

CodeExceptionGen (org.apache.bcel.generic.CodeExceptionGen)12 InstructionHandle (org.apache.bcel.generic.InstructionHandle)6 HashMap (java.util.HashMap)4 InstructionTargeter (org.apache.bcel.generic.InstructionTargeter)4 ArrayList (java.util.ArrayList)3 LinkedList (java.util.LinkedList)3 List (java.util.List)2 InstructionList (org.apache.bcel.generic.InstructionList)2 RET (org.apache.bcel.generic.RET)2 AbstractIntermediate (org.candle.decompiler.intermediate.code.AbstractIntermediate)2 MethodCode (com.jopdesign.common.MethodCode)1 StringWriter (java.io.StringWriter)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 TreeSet (java.util.TreeSet)1 Constant (org.apache.bcel.classfile.Constant)1 CPInstruction (org.apache.bcel.generic.CPInstruction)1 LineNumberGen (org.apache.bcel.generic.LineNumberGen)1 LocalVariableGen (org.apache.bcel.generic.LocalVariableGen)1 MethodGen (org.apache.bcel.generic.MethodGen)1