当前位置: 首页>>代码示例>>Java>>正文


Java CodeExceptionGen.getHandlerPC方法代码示例

本文整理汇总了Java中org.apache.bcel.generic.CodeExceptionGen.getHandlerPC方法的典型用法代码示例。如果您正苦于以下问题:Java CodeExceptionGen.getHandlerPC方法的具体用法?Java CodeExceptionGen.getHandlerPC怎么用?Java CodeExceptionGen.getHandlerPC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.bcel.generic.CodeExceptionGen的用法示例。


在下文中一共展示了CodeExceptionGen.getHandlerPC方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSpawnableCallWithException

import org.apache.bcel.generic.CodeExceptionGen; //导入方法依赖的package包/类
private SpawnableCall getSpawnableCallWithException(InstructionHandle invokeInstruction, 
    ArrayList<CodeExceptionGen> exceptionHandlers) {

ArrayList<LocalVariableGen> resultIndices = new ArrayList<LocalVariableGen>();
for (CodeExceptionGen exceptionHandler : exceptionHandlers) {
    InstructionHandle start = exceptionHandler.getHandlerPC(); 
    InstructionHandle end = getEndExceptionHandler(exceptionHandler);
    getIndicesStores(start, end, resultIndices);
}

LocalVariableGen[] dummy = new LocalVariableGen[resultIndices.size()];

return new SpawnableCall(invokeInstruction,
	getObjectReferenceLoadInstruction(invokeInstruction),
	resultIndices.toArray(dummy));
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:17,代码来源:SpawningMethod.java

示例2: getEndExceptionHandler

import org.apache.bcel.generic.CodeExceptionGen; //导入方法依赖的package包/类
/** Returns the end of an exception handler.
    *
    * @param codeException The codeException which end is returned.
    * @return The instructionHandle that is the end of the exception handler.
    */
   public InstructionHandle getEndExceptionHandler(CodeExceptionGen codeException) {
LocalVariableGen[] localVars = getLocalVariables();
InstructionHandle startHandler = codeException.getHandlerPC();

for (LocalVariableGen localVar : localVars) {
    InstructionHandle startScope = localVar.getStart();
    InstructionHandle endScope = localVar.getEnd();

    if (startScope == startHandler || startScope == startHandler.getNext() || 
	    startScope == startHandler.getNext().getNext() &&
	    localVar.getType().equals(codeException.getCatchType()))
	return endScope.getPrev();
}
throw new Error("no end exceptionhandler...");
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:21,代码来源:MethodGen.java

示例3: merge

import org.apache.bcel.generic.CodeExceptionGen; //导入方法依赖的package包/类
public static CodeExceptionGen merge(@CheckForNull TypeMerger m, CodeExceptionGen e1, CodeExceptionGen e2) {
    if (e1 == null) return e2;
    if (e2 == null) return e1;
    if (m == null)
        return e1;
    if ( ! e1.getHandlerPC().equals( e2.getHandlerPC() ) ){
        // log error
                    return e1;
    }
    try {
        Type t = m.mergeTypes(e1.getCatchType(), e2.getCatchType());
        return new CodeExceptionGen(e1.getStartPC(), e1.getEndPC(), e1.getHandlerPC(), (ObjectType) t);
    } catch (DataflowAnalysisException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return e1;
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:19,代码来源:ExceptionHandlerMap.java

示例4: ExceptionHandlers

import org.apache.bcel.generic.CodeExceptionGen; //导入方法依赖的package包/类
/**
 * Constructor. Creates a new ExceptionHandlers instance.
 * @param mg
 */
public ExceptionHandlers(MethodGen mg) {
    exceptionhandlers = new Hashtable<InstructionHandle, HashSet>();
    CodeExceptionGen[] cegs = mg.getExceptionHandlers();
    for (CodeExceptionGen ceg : cegs) {
        ExceptionHandler eh = new ExceptionHandler(ceg.getCatchType(), ceg.getHandlerPC());
        for (InstructionHandle ih = ceg.getStartPC(); ih != ceg.getEndPC().getNext(); ih = ih.getNext()) {
            HashSet<ExceptionHandler> hs;
            hs = exceptionhandlers.get(ih);
            if (hs == null) {
                hs = new HashSet<ExceptionHandler>();
                exceptionhandlers.put(ih, hs);
            }
            hs.add(eh);
        }
    }
}
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:21,代码来源:ExceptionHandlers.java

示例5: getEndOfCatchBlock

import org.apache.bcel.generic.CodeExceptionGen; //导入方法依赖的package包/类
static InstructionHandle getEndOfCatchBlock(MethodGen m,
    CodeExceptionGen catchBlock) {

if (catchBlock.getCatchType() == null) {
    // finally clause, no local variable!
    return null;
}

LocalVariableGen[] lt = m.getLocalVariables();

InstructionHandle handler = catchBlock.getHandlerPC();

for (int i = 0; i < lt.length; i++) {
    InstructionHandle start = lt[i].getStart();
    InstructionHandle end = lt[i].getEnd();

    // dangerous, javac is one instruction further...
    if ((start == handler || start == handler.getNext() || start == handler
	    .getNext().getNext())
	    && lt[i].getType().equals(catchBlock.getCatchType())) {
	// System.out.println("found range of catch block: "
	// + handler + " - " + end);
	return end.getPrev();
    }
}

System.err
	.println("Could not find end of catch block, did you compile "
		+ "with the '-g' option?");
System.exit(1);
return null;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:33,代码来源:MethodTable.java

示例6: insertTypecheckCode

import org.apache.bcel.generic.CodeExceptionGen; //导入方法依赖的package包/类
InstructionHandle insertTypecheckCode(MethodGen m, InstructionList il,
    InstructionHandle pos, int spawnId, int exceptionPos) {
    ArrayList<CodeExceptionGen> catches = mtab.getCatchTypes(m, spawnId);

    InstructionHandle[] jumpTargets = new InstructionHandle[catches.size() + 1];

    BranchHandle[] jumps = new BranchHandle[catches.size()];

    for (int i = 0; i < catches.size(); i++) {
        CodeExceptionGen e = catches.get(i);
        ObjectType type = e.getCatchType();
        InstructionHandle catchTarget = e.getHandlerPC();

        jumpTargets[i] = il.insert(pos, new ALOAD(exceptionPos));
        il.insert(pos, new INSTANCEOF(cpg.addClass(type)));
        il.insert(pos, new BIPUSH((byte) 1));
        jumps[i] = il.insert(pos, new IF_ICMPNE(null));
        il.insert(pos, new ALOAD(exceptionPos));
        il.insert(pos, ins_f.createCheckCast(type));
        il.insert(pos, new GOTO(catchTarget));
    }

    InstructionHandle t = il.insert(pos, new ALOAD(exceptionPos));
    il.insert(pos, new ATHROW());

    jumpTargets[catches.size()] = t;

    for (int i = 0; i < catches.size(); i++) {
        jumps[i].setTarget(jumpTargets[i + 1]);
    }

    return pos;
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:34,代码来源:Cashmerec.java

示例7: handleExceptions

import org.apache.bcel.generic.CodeExceptionGen; //导入方法依赖的package包/类
/**
 * Add exception edges for given instruction.
 *
 * @param subroutine
 *            the subroutine containing the instruction
 * @param pei
 *            the instruction which throws an exception
 * @param etb
 *            the exception thrower block (ETB) for the instruction
 */
private void handleExceptions(Subroutine subroutine, InstructionHandle pei, BasicBlock etb) {
    etb.setExceptionThrower(pei);

    // Remember whether or not a universal exception handler
    // is reachable. If so, then we know that exceptions raised
    // at this instruction cannot propagate out of the method.
    boolean sawUniversalExceptionHandler = false;

    List<CodeExceptionGen> exceptionHandlerList = exceptionHandlerMap.getHandlerList(pei);
    if (exceptionHandlerList != null) {
        for (CodeExceptionGen exceptionHandler : exceptionHandlerList) {
            InstructionHandle handlerStart = exceptionHandler.getHandlerPC();
            subroutine.addEdgeAndExplore(etb, handlerStart, HANDLED_EXCEPTION_EDGE);

            if (Hierarchy.isUniversalExceptionHandler(exceptionHandler.getCatchType()))
                sawUniversalExceptionHandler = true;
        }
    }

    // If required, mark this block as throwing an unhandled exception.
    // For now, we assume that if there is no reachable handler that handles
    // ANY exception type, then the exception can be thrown out of the
    // method.
    if (!sawUniversalExceptionHandler) {
        if (DEBUG)
            System.out.println("Adding unhandled exception edge from " + pei);
        subroutine.setUnhandledExceptionBlock(etb);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:40,代码来源:BetterCFGBuilder2.java

示例8: addExceptionHandler

import org.apache.bcel.generic.CodeExceptionGen; //导入方法依赖的package包/类
private void addExceptionHandler(CodeExceptionGen exceptionHandler) {
    InstructionHandle handlerPC = exceptionHandler.getHandlerPC();
    CodeExceptionGen existing = startInstructionToHandlerMap.get(handlerPC);
    if (existing != null) {
        exceptionHandler = merge (this.merger, existing, exceptionHandler);
    }
    startInstructionToHandlerMap.put(handlerPC, exceptionHandler);
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:9,代码来源:ExceptionHandlerMap.java


注:本文中的org.apache.bcel.generic.CodeExceptionGen.getHandlerPC方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。