本文整理汇总了Java中org.jf.dexlib2.iface.ExceptionHandler类的典型用法代码示例。如果您正苦于以下问题:Java ExceptionHandler类的具体用法?Java ExceptionHandler怎么用?Java ExceptionHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExceptionHandler类属于org.jf.dexlib2.iface包,在下文中一共展示了ExceptionHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compareTo
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
@Override
public int compareTo(@Nonnull ExceptionHandler o) {
int res;
String exceptionType = getExceptionType();
if (exceptionType == null) {
if (o.getExceptionType() != null) {
return 1;
}
} else {
String otherExceptionType = o.getExceptionType();
if (otherExceptionType == null) {
return -1;
}
res = exceptionType.compareTo(o.getExceptionType());
if (res != 0) return res;
}
return Ints.compare(getHandlerCodeAddress(), o.getHandlerCodeAddress());
}
示例2: addHandler
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
public void addHandler(@Nonnull EH handler) {
for (ExceptionHandler existingHandler: exceptionHandlers) {
String existingType = existingHandler.getExceptionType();
String newType = handler.getExceptionType();
if (existingType == null) {
if (newType == null) {
if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
throw new InvalidTryException(
"Multiple overlapping catch all handlers with different handlers");
}
return;
}
} else if (existingType.equals(newType)) {
// dalvik doesn't reject cases when there are multiple catches with the same exception
// but different handlers. In practice, the first handler "wins". Since the later
// handler will never be used, we don't add it.
return;
}
}
exceptionHandlers.add(handler);
}
示例3: addHandler
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
public void addHandler(@Nonnull EH handler) {
for (ExceptionHandler existingHandler: exceptionHandlers) {
String existingType = existingHandler.getExceptionType();
String newType = handler.getExceptionType();
// Don't add it if we already have a handler of the same type
if (existingType == null) {
if (newType == null) {
if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
throw new InvalidTryException(
"Multiple overlapping catch all handlers with different handlers");
}
return;
}
} else if (existingType.equals(newType)) {
if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
throw new InvalidTryException(
"Multiple overlapping catches for %s with different handlers", existingType);
}
return;
}
}
exceptionHandlers.add(handler);
}
示例4: usedTypes
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
/**
* Return the types that are used in this body.
*/
public Set<Type> usedTypes() {
Set<Type> types = new HashSet<Type>();
for (DexlibAbstractInstruction i : instructions)
types.addAll(i.introducedTypes());
if(tries!=null) {
for (TryBlock<? extends ExceptionHandler> tryItem : tries) {
List<? extends ExceptionHandler> hList = tryItem.getExceptionHandlers();
for (ExceptionHandler handler: hList) {
String exType = handler.getExceptionType();
if (exType == null) // for handler which capture all Exceptions
continue;
types.add(DexType.toSoot(exType));
}
}
}
return types;
}
示例5: compareTo
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
@Override
public int compareTo( ExceptionHandler o) {
int res;
String exceptionType = getExceptionType();
if (exceptionType == null) {
if (o.getExceptionType() != null) {
return 1;
}
} else {
String otherExceptionType = o.getExceptionType();
if (otherExceptionType == null) {
return -1;
}
res = exceptionType.compareTo(o.getExceptionType());
if (res != 0) return res;
}
return Ints.compare(getHandlerCodeAddress(), o.getHandlerCodeAddress());
}
示例6: addHandler
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
public void addHandler( EH handler) {
for (ExceptionHandler existingHandler: exceptionHandlers) {
String existingType = existingHandler.getExceptionType();
String newType = handler.getExceptionType();
if (existingType == null) {
if (newType == null) {
if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
throw new InvalidTryException(
"Multiple overlapping catch all handlers with different handlers");
}
return;
}
} else if (existingType.equals(newType)) {
// dalvik doesn't reject cases when there are multiple catches with the same exception
// but different handlers. In practice, the first handler "wins". Since the later
// handler will never be used, we don't add it.
return;
}
}
exceptionHandlers.add(handler);
}
示例7: compare
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
@Override
public int compare(ExceptionHandler o1, ExceptionHandler o2) {
String exceptionType1 = o1.getExceptionType();
if (exceptionType1 == null) {
if (o2.getExceptionType() != null) {
return 1;
}
return 0;
} else {
String exceptionType2 = o2.getExceptionType();
if (exceptionType2 == null) {
return -1;
}
return exceptionType1.compareTo(o2.getExceptionType());
}
}
示例8: addHandler
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
public void addHandler(@Nonnull EH handler) {
for (ExceptionHandler existingHandler : exceptionHandlers) {
String existingType = existingHandler.getExceptionType();
String newType = handler.getExceptionType();
// Don't add it if we already have a handler of the same type
if (existingType == null) {
if (newType == null) {
if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
throw new InvalidTryException(
"Multiple overlapping catch all handlers with different handlers");
}
return;
}
} else if (existingType.equals(newType)) {
if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
throw new InvalidTryException(
"Multiple overlapping catches for %s with different handlers", existingType);
}
return;
}
}
exceptionHandlers.add(handler);
}
示例9: reMethodImpl
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
@Override
protected MethodImplementation reMethodImpl(MethodImplementation methodImplementation) {
if (methodImplementation == null){
return null;
}
Iterable<? extends Instruction> instructions = methodImplementation.getInstructions();
Iterable<? extends DebugItem> debugItems = methodImplementation.getDebugItems();
List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = methodImplementation.getTryBlocks();
return new ImmutableMethodImplementation(methodImplementation.getRegisterCount(), reInstructions(instructions), reTryCatchBlock(methodImplementation.getTryBlocks()), reDebugItem(methodImplementation.getDebugItems()));
}
示例10: reTryCatchBlock
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
@Override
protected List<? extends TryBlock<? extends ExceptionHandler>> reTryCatchBlock(List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks) {
if (tryBlocks == null || tryBlocks.size() == 0) {
return null;
}
List<ImmutableTryBlock> newTryCatchBlocks = new ArrayList<ImmutableTryBlock>();
for (TryBlock<? extends ExceptionHandler> tryBlock : tryBlocks) {
newTryCatchBlocks.add(ImmutableTryBlock.of(tryBlock));
}
return newTryCatchBlocks;
}
示例11: ImmutableMethodImplementation
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
public ImmutableMethodImplementation(int registerCount,
@Nullable Iterable<? extends Instruction> instructions,
@Nullable List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks,
@Nullable Iterable<? extends DebugItem> debugItems) {
this.registerCount = registerCount;
this.instructions = ImmutableInstruction.immutableListOf(instructions);
this.tryBlocks = ImmutableTryBlock.immutableListOf(tryBlocks);
this.debugItems = ImmutableDebugItem.immutableListOf(debugItems);
}
示例12: of
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
public static ImmutableExceptionHandler of(ExceptionHandler exceptionHandler) {
if (exceptionHandler instanceof ImmutableExceptionHandler) {
return (ImmutableExceptionHandler)exceptionHandler;
}
return new ImmutableExceptionHandler(
exceptionHandler.getExceptionType(),
exceptionHandler.getHandlerCodeAddress());
}
示例13: ImmutableTryBlock
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
public ImmutableTryBlock(int startCodeAddress,
int codeUnitCount,
@Nullable List<? extends ExceptionHandler> exceptionHandlers) {
this.startCodeAddress = startCodeAddress;
this.codeUnitCount = codeUnitCount;
this.exceptionHandlers = ImmutableExceptionHandler.immutableListOf(exceptionHandlers);
}
示例14: of
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
public static ImmutableTryBlock of(TryBlock<? extends ExceptionHandler> tryBlock) {
if (tryBlock instanceof ImmutableTryBlock) {
return (ImmutableTryBlock)tryBlock;
}
return new ImmutableTryBlock(
tryBlock.getStartCodeAddress(),
tryBlock.getCodeUnitCount(),
tryBlock.getExceptionHandlers());
}
示例15: equals
import org.jf.dexlib2.iface.ExceptionHandler; //导入依赖的package包/类
@Override
public boolean equals(@Nullable Object o) {
if (o instanceof ExceptionHandler) {
ExceptionHandler other = (ExceptionHandler)o;
return Objects.equal(getExceptionType(), other.getExceptionType()) &&
(getHandlerCodeAddress() == other.getHandlerCodeAddress());
}
return false;
}