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


Java CodeExceptionGen类代码示例

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


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

示例1: transfer

import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
public void transfer(BasicBlock basicBlock, InstructionHandle end, BlockType start, BlockType result)
		throws DataflowAnalysisException {
	result.copyFrom(start);

	if (start.isValid()) {
		if (basicBlock.isExceptionHandler()) {
			CodeExceptionGen exceptionGen = basicBlock.getExceptionGen();
			ObjectType catchType = exceptionGen.getCatchType();
			if (catchType == null) {
				// Probably a finally block, or a synchronized block
				// exception-compensation catch block.
				result.pushFinally();
			} else {
				// Catch type was explicitly specified:
				// this is probably a programmer-written catch block
				result.pushCatch();
			}
		}
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:BlockTypeAnalysis.java

示例2: SpawnTableEntry

import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
SpawnTableEntry(SpawnTableEntry orig, MethodGen mg, MethodGen origM) {
    isLocalUsed = new boolean[origM.getMaxLocals()];

    hasInlet = orig.hasInlet;
    if (hasInlet) {
	/* copy and rewite exception table */
	CodeExceptionGen origE[] = origM.getExceptionHandlers();
	CodeExceptionGen newE[] = mg.getExceptionHandlers();

	catchBlocks = new ArrayList<CodeExceptionGen>();

	for (int i = 0; i < orig.catchBlocks.size(); i++) {
	    CodeExceptionGen origCatch = orig.catchBlocks.get(i);
	    for (int j = 0; j < origE.length; j++) {
		if (origCatch == origE[j]) {
		    catchBlocks.add(newE[j]);
		    break;
		}
	    }
	}
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:23,代码来源:MethodTable.java

示例3: getExceptionHandler

import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
CodeExceptionGen getExceptionHandler(MethodGen m, InstructionHandle self) {
    CodeExceptionGen exc[] = m.getExceptionHandlers();

    for (int j = 0; j < exc.length; j++) {
        InstructionHandle h = exc[j].getStartPC();
        InstructionHandle h2 = exc[j].getEndPC();
        do {
            if (h == self) {
                return exc[j];
            }
            h = h.getNext();
        } while (h != h2);
        if (h == self) {
            return exc[j];
        }
    }

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

示例4: getExceptionHandlers

import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
private ArrayList<CodeExceptionGen> getExceptionHandlers(InstructionHandle ih, MethodGen spawnSignature) {
CodeExceptionGen[] codeExceptions = getExceptionHandlers();
ArrayList<CodeExceptionGen> result = new ArrayList<CodeExceptionGen>();

for (CodeExceptionGen codeException : codeExceptions) {
    // codeException.containsTarget has a BUG????
    /*
    if (codeException.containsTarget(ih) && hasRightType(codeException, spawnSignature)) {
	result.add(codeException);
    }
    */
    if (Util.containsTarget(codeException, ih) && hasRightType(codeException, spawnSignature)) {
	result.add(codeException);
    }
}

return result;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:19,代码来源:SpawningMethod.java

示例5: 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

示例6: 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

示例7: getBlock

import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
/**
 * Get the basic block in the subroutine for the given instruction. If
 * the block doesn't exist yet, it is created, and a work list item is
 * added which will populate it. Note that if start is an exception
 * thrower, the block returned will be its ETB.
 *
 * @param start
 *            the start instruction for the block
 * @return the basic block for the instruction
 */
public BasicBlock getBlock(InstructionHandle start) {
    BasicBlock block = blockMap.get(start);
    if (block == null) {
        block = allocateBasicBlock();
        blockMap.put(start, block);

        // Block is an exception handler?
        CodeExceptionGen exceptionGen = exceptionHandlerMap.getHandlerForStartInstruction(start);
        if (exceptionGen != null)
            block.setExceptionGen(exceptionGen);

        addItem(new WorkListItem(start, block));
    }
    return block;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:26,代码来源:BetterCFGBuilder2.java

示例8: transfer

import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
public void transfer(BasicBlock basicBlock, @CheckForNull InstructionHandle end, BlockType start, BlockType result)
        throws DataflowAnalysisException {
    result.copyFrom(start);

    if (start.isValid()) {
        if (basicBlock.isExceptionHandler()) {
            CodeExceptionGen exceptionGen = basicBlock.getExceptionGen();
            ObjectType catchType = exceptionGen.getCatchType();
            if (catchType == null) {
                // Probably a finally block, or a synchronized block
                // exception-compensation catch block.
                result.pushFinally();
            } else {
                // Catch type was explicitly specified:
                // this is probably a programmer-written catch block
                result.pushCatch();
            }
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:21,代码来源:BlockTypeAnalysis.java

示例9: 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

示例10: getBlock

import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
/**
 * Get the basic block in the subroutine for the given instruction. If
 * the block doesn't exist yet, it is created, and a work list item is
 * added which will populate it. Note that if start is an exception
 * thrower, the block returned will be its ETB.
 *
 * @param start
 *            the start instruction for the block
 * @return the basic block for the instruction
 */
public BasicBlock getBlock(InstructionHandle start) {
    BasicBlock block = blockMap.get(start);
    if (block == null) {
        block = allocateBasicBlock();
        blockMap.put(start, block);

        // Block is an exception handler?
        CodeExceptionGen exceptionGen = exceptionHandlerMap.getHandlerForStartInstruction(start);
        if (exceptionGen != null)
            block.setExceptionGen(null, exceptionGen);

        addItem(new WorkListItem(start, block));
    }
    return block;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:26,代码来源:BetterCFGBuilder2.java

示例11: ExceptionHandlers

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

示例12: 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

示例13: print

import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
public void print(PrintStream out) {
	Iterator<BasicBlock> i = cfg.blockIterator();
	while (i.hasNext()) {
		BasicBlock bb = i.next();
		out.println();
		out.println("BASIC BLOCK: " + bb.getId() + (bb.isExceptionThrower() ? " [EXCEPTION THROWER]" : "") + blockStartAnnotate(bb));
		if (bb.isExceptionThrower()) {
			out.println("  Exception thrower: " + bb.getExceptionThrower());
		}
		CodeExceptionGen exceptionGen = bb.getExceptionGen();
		if (exceptionGen != null) {
			System.out.println("	CATCHES " + exceptionGen.getCatchType());
		}
		Iterator<InstructionHandle> j = instructionIterator(bb);
		while (j.hasNext()) {
			InstructionHandle handle = j.next();
			out.println(handle + instructionAnnotate(handle, bb));
		}
		out.println("END" + blockAnnotate(bb));
		Iterator<Edge> edgeIter =
			isForwards
				? cfg.outgoingEdgeIterator(bb)
				: cfg.incomingEdgeIterator(bb);
		while (edgeIter.hasNext()) {
			Edge edge = edgeIter.next();
			out.println("  " + edge.formatAsString(!isForwards) + " " + edgeAnnotate(edge));
		}
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:CFGPrinter.java

示例14: addHandler

import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
private void addHandler(InstructionHandle handle, CodeExceptionGen exceptionHandler) {
	List<CodeExceptionGen> handlerList = codeToHandlerMap.get(handle);
	if (handlerList == null) {
		handlerList = new LinkedList<CodeExceptionGen>();
		codeToHandlerMap.put(handle, handlerList);
	}
	handlerList.add(exceptionHandler);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:ExceptionHandlerMap.java

示例15: meetInto

import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
public void meetInto(BetterTypeFrame fact, Edge edge, BetterTypeFrame result)
        throws DataflowAnalysisException {

	// TODO: implement ACCURATE_EXCEPTIONS

	if (fact.isValid() && edge.getTarget().isExceptionHandler()) {
		BetterTypeFrame tmpFact = null;

		// Exception handler.
		// Clear stack and push exception handler catch type.

		tmpFact = modifyFrame(fact, tmpFact);
		tmpFact.clearStack();

		CodeExceptionGen exceptionGen = edge.getTarget().getExceptionGen();
		org.apache.bcel.generic.ObjectType catchType = exceptionGen.getCatchType();
		if (catchType == null) {
			tmpFact.pushValue(typeRepository.classTypeFromSignature(JAVA_LANG_THROWABLE_SIGNATURE));
		} else {
			tmpFact.pushValue(typeRepository.classTypeFromDottedClassName(catchType.getClassName()));
		}

		fact = tmpFact;
	}

	mergeInto(fact, result);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:29,代码来源:BetterTypeAnalysis.java


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