|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import javassist.ClassPool; |
|
|
import javassist.ClassPool; |
|
|
|
|
|
import javassist.CtClass; |
|
|
import javassist.NotFoundException; |
|
|
import javassist.NotFoundException; |
|
|
import javassist.bytecode.*; |
|
|
import javassist.bytecode.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
while (handler != null) { |
|
|
while (handler != null) { |
|
|
TypedBlock tb = (TypedBlock)handler.body; |
|
|
TypedBlock tb = (TypedBlock)handler.body; |
|
|
if (tb.alreadySet()) |
|
|
|
|
|
|
|
|
if (tb.alreadySet()) { |
|
|
mergeMap(tb, false); |
|
|
mergeMap(tb, false); |
|
|
|
|
|
if (tb.stackTop < 1) |
|
|
|
|
|
throw new BadBytecode("bad catch clause: " + handler.typeIndex); |
|
|
|
|
|
|
|
|
|
|
|
tb.stackTypes[0] = merge(toExceptionType(handler.typeIndex), |
|
|
|
|
|
tb.stackTypes[0]); |
|
|
|
|
|
} |
|
|
else { |
|
|
else { |
|
|
recordStackMap(tb, handler.typeIndex); |
|
|
recordStackMap(tb, handler.typeIndex); |
|
|
MapMaker maker = new MapMaker(this); |
|
|
MapMaker maker = new MapMaker(this); |
|
|
|
|
|
|
|
|
throws BadBytecode |
|
|
throws BadBytecode |
|
|
{ |
|
|
{ |
|
|
TypeData[] tStackTypes = TypeData.make(stackTypes.length); |
|
|
TypeData[] tStackTypes = TypeData.make(stackTypes.length); |
|
|
|
|
|
tStackTypes[0] = toExceptionType(exceptionType).join(); |
|
|
|
|
|
recordStackMap0(target, 1, tStackTypes); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private TypeData.ClassName toExceptionType(int exceptionType) { |
|
|
String type; |
|
|
String type; |
|
|
if (exceptionType == 0) // for finally clauses |
|
|
if (exceptionType == 0) // for finally clauses |
|
|
type = "java.lang.Throwable"; |
|
|
|
|
|
|
|
|
type= "java.lang.Throwable"; |
|
|
else |
|
|
else |
|
|
type = cpool.getClassInfo(exceptionType); |
|
|
type = cpool.getClassInfo(exceptionType); |
|
|
|
|
|
|
|
|
tStackTypes[0] = new TypeData.ClassName(type); |
|
|
|
|
|
recordStackMap0(target, 1, tStackTypes); |
|
|
|
|
|
|
|
|
return new TypeData.ClassName(type); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void recordStackMap0(TypedBlock target, int st, TypeData[] tStackTypes) |
|
|
private void recordStackMap0(TypedBlock target, int st, TypeData[] tStackTypes) |