@Nonnull @Override public List<? extends TryBlock<? extends ExceptionHandler>> getTryBlocks( @Nonnull PoolMethod method) { MethodImplementation impl = method.getImplementation(); if (impl != null) { return impl.getTryBlocks(); } return ImmutableList.of(); }
private String[] buildExceptions(Method method) { if (method.getImplementation() == null) { return null; } Set<String> exceptionTypes = new HashSet<>(); for (TryBlock<? extends ExceptionHandler> tryBlock : method.getImplementation() .getTryBlocks()) { for (ExceptionHandler handler : tryBlock.getExceptionHandlers()) { String type = handler.getExceptionType(); if (type == null) { // Type is null if it's a catchall continue; } exceptionTypes.add(stripName(type)); } } return exceptionTypes.toArray(new String[0]); }
private void addTries(List<MethodItem> methodItems) { List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = methodImpl.getTryBlocks(); if (tryBlocks.size() == 0) { return;
for (TryBlock<? extends ExceptionHandler> tryBlock : methodImplementation.getTryBlocks()) { Label startLabel = newLabel(codeAddressToIndex, tryBlock.getStartCodeAddress()); Label endLabel = newLabel(codeAddressToIndex, tryBlock.getStartCodeAddress() + tryBlock.getCodeUnitCount());
tries = code.getTryBlocks();
List<? extends TryBlock> tryBlocks = methodImpl.getTryBlocks(); if (!hasInstruction && tryBlocks.size() > 0) { throw new ExceptionWithContext("Method %s has no instructions, but has try blocks.", for (TryBlock<? extends ExceptionHandler> tryBlock: methodImpl.getTryBlocks()) { for (ExceptionHandler handler: tryBlock.getExceptionHandlers()) { dexPool.typeSection.internNullable(handler.getExceptionType());
private void analyzeMoveException(@Nonnull AnalyzedInstruction analyzedInstruction) { int instructionAddress = getInstructionAddress(analyzedInstruction); RegisterType exceptionType = RegisterType.UNKNOWN_TYPE; for (TryBlock<? extends ExceptionHandler> tryBlock: methodImpl.getTryBlocks()) { for (ExceptionHandler handler: tryBlock.getExceptionHandlers()) { if (handler.getHandlerCodeAddress() == instructionAddress) { String type = handler.getExceptionType(); if (type == null) { exceptionType = RegisterType.getRegisterType(RegisterType.REFERENCE, classPath.getClass("Ljava/lang/Throwable;")); } else { exceptionType = RegisterType.getRegisterType(RegisterType.REFERENCE, classPath.getClass(type)) .merge(exceptionType); } } } } if (exceptionType.category == RegisterType.UNKNOWN) { throw new AnalysisException("move-exception must be the first instruction in an exception handler block"); } setDestinationRegisterTypeAndPropagateChanges(analyzedInstruction, exceptionType); }
if (methodImplementation.getTryBlocks().size() > 0) { throw new SemanticException(input, I_METHOD72, "try/catch blocks cannot be present in %s method", methodType);
List<? extends TryBlock<? extends ExceptionHandler>> tries = methodImpl.getTryBlocks(); tries = TryListBuilder.massageTryBlocks(tries); int triesIndex = 0;
@Nonnull @Override public List<? extends TryBlock<? extends ExceptionHandler>> getTryBlocks(@Nonnull BuilderMethod builderMethod) { MethodImplementation impl = builderMethod.getImplementation(); if (impl == null) { return ImmutableList.of(); } return impl.getTryBlocks(); }
@Override public boolean hasExceptionHandler() { List<? extends TryBlock<? extends org.jf.dexlib2.iface.ExceptionHandler>> tries = eMethod.getImplementation().getTryBlocks(); return tries==null?false:tries.size() > 0; }
@Nonnull @Override public List<? extends TryBlock<? extends ExceptionHandler>> getTryBlocks(@Nonnull BuilderMethod builderMethod) { MethodImplementation impl = builderMethod.getImplementation(); if (impl == null) { return ImmutableList.of(); } return impl.getTryBlocks(); }
@Nonnull @Override public List<? extends TryBlock<? extends ExceptionHandler>> getTryBlocks( @Nonnull PoolMethod method) { MethodImplementation impl = method.getImplementation(); if (impl != null) { return impl.getTryBlocks(); } return ImmutableList.of(); }
@Override public boolean hasExceptionHandler() { List<? extends TryBlock<? extends org.jf.dexlib2.iface.ExceptionHandler>> tries = eMethod.getImplementation().getTryBlocks(); return tries==null?false:tries.size() > 0; }
@Nonnull @Override public List<? extends TryBlock<? extends ExceptionHandler>> getTryBlocks( @Nonnull PoolMethod method) { MethodImplementation impl = method.getImplementation(); if (impl != null) { return impl.getTryBlocks(); } return ImmutableList.of(); }
@Nonnull @Override public List<? extends TryBlock<? extends ExceptionHandler>> getTryBlocks(@Nonnull BuilderMethod builderMethod) { MethodImplementation impl = builderMethod.getImplementation(); if (impl == null) { return ImmutableList.of(); } return impl.getTryBlocks(); }
@Override @Nonnull public List<? extends TryBlock<? extends ExceptionHandler>> getTryBlocks() { return RewriterUtils.rewriteList(rewriters.getTryBlockRewriter(), methodImplementation.getTryBlocks()); }
@Override @Nonnull public List<? extends TryBlock<? extends ExceptionHandler>> getTryBlocks() { return RewriterUtils.rewriteList(rewriters.getTryBlockRewriter(), methodImplementation.getTryBlocks()); }
@Nullable public static ImmutableMethodImplementation of(@Nullable MethodImplementation methodImplementation) { if (methodImplementation == null) { return null; } if (methodImplementation instanceof ImmutableMethodImplementation) { return (ImmutableMethodImplementation)methodImplementation; } return new ImmutableMethodImplementation( methodImplementation.getRegisterCount(), methodImplementation.getInstructions(), methodImplementation.getTryBlocks(), methodImplementation.getDebugItems()); }
@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())); }