本文整理汇总了Java中org.apache.bcel.generic.CodeExceptionGen类的典型用法代码示例。如果您正苦于以下问题:Java CodeExceptionGen类的具体用法?Java CodeExceptionGen怎么用?Java CodeExceptionGen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeExceptionGen类属于org.apache.bcel.generic包,在下文中一共展示了CodeExceptionGen类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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
示例17: 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
示例18: hasRightType
import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
private boolean hasRightType(CodeExceptionGen codeException, MethodGen method) {
ObjectType catchType = codeException.getCatchType();
if (catchType == null) return false;
String[] exceptionTypeNames = method.getExceptions();
ObjectType[] exceptionTypes = new ObjectType[exceptionTypeNames.length];
for (int i = 0; i < exceptionTypeNames.length; i++) {
exceptionTypes[i] = new ObjectType(exceptionTypeNames[i]);
}
return containsType(catchType, exceptionTypes);
}
开发者ID:pieterhijma,项目名称:cashmere,代码行数:11,代码来源:SpawningMethod.java
示例19: find_ceg
import org.apache.bcel.generic.CodeExceptionGen; //导入依赖的package包/类
private CodeExceptionGen find_ceg(CodeExceptionGen[] cegs, int pos) {
CodeExceptionGen ret = null;
for (CodeExceptionGen ceg : cegs) {
int start = ceg.getStartPC().getPosition();
int end = ceg.getEndPC().getPosition();
if (start <= pos && pos <= end) {
ret = ceg;
break;
}
}
return ret;
}
开发者ID:USC-NSL,项目名称:SIF,代码行数:14,代码来源:SuspectMethodFinder.java
示例20: 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.getLabel() + (bb.isExceptionThrower() ? " [EXCEPTION THROWER]" : "")
+ blockStartAnnotate(bb));
if (bb.isExceptionThrower()) {
out.println(" Exception thrower: " + bb.getExceptionThrower());
}
CodeExceptionGen exceptionGen = bb.getExceptionGen();
if (exceptionGen != null) {
out.println("\tCATCHES " + 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:ytus,项目名称:findbugs-all-the-bugs,代码行数:28,代码来源:CFGPrinter.java
注:本文中的org.apache.bcel.generic.CodeExceptionGen类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论