Java Code Examples for org.jf.dexlib2.iface.MethodImplementation#getTryBlocks()
The following examples show how to use
org.jf.dexlib2.iface.MethodImplementation#getTryBlocks() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImmutableMethodImplementation.java From ZjDroid with Apache License 2.0 | 5 votes |
@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()); }
Example 2
Source File: BuilderClassPool.java From ZjDroid with Apache License 2.0 | 5 votes |
@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(); }
Example 3
Source File: MethodImplReIClassDef.java From atlas with Apache License 2.0 | 5 votes |
@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())); }
Example 4
Source File: ImmutableMethodImplementation.java From zjdroid with Apache License 2.0 | 5 votes |
@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()); }
Example 5
Source File: BuilderClassPool.java From zjdroid with Apache License 2.0 | 5 votes |
@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(); }
Example 6
Source File: ImmutableMethodImplementation.java From HeyGirl with Apache License 2.0 | 5 votes |
@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()); }
Example 7
Source File: BuilderClassPool.java From HeyGirl with Apache License 2.0 | 5 votes |
@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(); }
Example 8
Source File: ImmutableMethodImplementation.java From ZjDroid with Apache License 2.0 | 5 votes |
@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()); }
Example 9
Source File: BuilderClassPool.java From ZjDroid with Apache License 2.0 | 5 votes |
@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(); }
Example 10
Source File: DexBody.java From JAADAS with GNU General Public License v3.0 | 4 votes |
/** * @param code the codeitem that is contained in this body * @param method the method that is associated with this body */ public DexBody(DexFile dexFile, Method method, RefType declaringClassType) { MethodImplementation code = method.getImplementation(); if (code == null) throw new RuntimeException("error: no code for method "+ method.getName()); this.declaringClassType = declaringClassType; tries = code.getTryBlocks(); methodSignature = method.getDefiningClass() +": "+ method.getReturnType() +" "+ method.getName() +"("; for (MethodParameter mp: method.getParameters()) methodSignature += mp.getType() +","; List<? extends CharSequence> paramTypes = method.getParameterTypes(); if (paramTypes != null) { parameterTypes = new ArrayList<Type>(); for (CharSequence type : paramTypes) parameterTypes.add(DexType.toSoot(type.toString())); } else { parameterTypes = Collections.emptyList(); } isStatic = Modifier.isStatic(method.getAccessFlags()); numRegisters = code.getRegisterCount(); numParameterRegisters = MethodUtil.getParameterRegisterCount(method); if (!isStatic) numParameterRegisters--; instructions = new ArrayList<DexlibAbstractInstruction>(); instructionAtAddress = new HashMap<Integer, DexlibAbstractInstruction>(); registerLocals = new Local[numRegisters]; int address = 0; for (Instruction instruction : code.getInstructions()) { DexlibAbstractInstruction dexInstruction = fromInstruction(instruction, address); instructions.add(dexInstruction); instructionAtAddress.put(address, dexInstruction); Debug.printDbg(" put instruction '", dexInstruction ,"' at 0x", Integer.toHexString(address)); address += instruction.getCodeUnits(); } // Check taken from Android's dalvik/libdex/DexSwapVerify.cpp if (numParameterRegisters > numRegisters) throw new RuntimeException("Malformed dex file: insSize (" + numParameterRegisters + ") > registersSize (" + numRegisters + ")"); for (DebugItem di: code.getDebugItems()) { if (di instanceof ImmutableLineNumber) { ImmutableLineNumber ln = (ImmutableLineNumber)di; DexlibAbstractInstruction ins = instructionAtAddress(ln.getCodeAddress()); if (ins == null) { Debug.printDbg("Line number tag pointing to invalid offset: " + ln.getCodeAddress()); continue; } ins.setLineNumber(ln.getLineNumber()); Debug.printDbg("Add line number tag " + ln.getLineNumber() + " for instruction: " + instructionAtAddress(ln.getCodeAddress())); } } this.dexFile = dexFile; }