@Override public Set<? extends Annotation> apply(MethodParameter input) { return input.getAnnotations(); } };
@Override public int getAccessFlags() { return method.getAccessFlags(); }
@Nullable private String getContainingClassForImplicitReference() { if (classDef.options.implicitReferences) { return classDef.classDef.getType(); } return null; }
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 boolean needsAnalyzed() { for (Instruction instruction: methodImpl.getInstructions()) { if (instruction.getOpcode().odexOnly()) { return true; } } return false; }
@Nonnull private AnalyzedInstruction[] buildExceptionHandlerArray(@Nonnull TryBlock<? extends ExceptionHandler> tryBlock) { List<? extends ExceptionHandler> exceptionHandlers = tryBlock.getExceptionHandlers(); AnalyzedInstruction[] handlerInstructions = new AnalyzedInstruction[exceptionHandlers.size()]; for (int i=0; i<exceptionHandlers.size(); i++) { handlerInstructions[i] = analyzedInstructions.get(exceptionHandlers.get(i).getHandlerCodeAddress()); } return handlerInstructions; }
private String buildDescriptor(Method method) { StringBuilder sb = new StringBuilder(); sb.append('('); method.getParameterTypes().forEach(sb::append); sb.append(')'); sb.append(method.getReturnType()); return sb.toString(); }
@Nullable @Override public MethodImplementation getImplementation() { return method.getImplementation(); } }
@Nonnull @Override public String getName() { return method.getName(); }
private void visitInitStub(ClassDef classDef, MethodVisitor mv) { mv.visitCode(); mv.visitVarInsn(Opcodes.ALOAD, 0); if (classDef.getSuperclass() != null) { String superName = stripName(classDef.getSuperclass()); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, superName, "<init>", "()V", false); } mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); }
@Override public int getFieldAccessFlags(@Nonnull Field field) { return field.getAccessFlags(); }
private String[] buildInterfaces(ClassDef classDef) { List<String> interfaces = classDef.getInterfaces(); return interfaces.stream().map(this::stripName) .toArray(size -> new String[interfaces.size()]); }
private void addDebugInfo(final List<MethodItem> methodItems) { for (DebugItem debugItem: methodImpl.getDebugItems()) { methodItems.add(DebugMethodItem.build(registerFormatter, debugItem)); } }
@Override public int getRegisterCount(@Nonnull PoolMethod method) { MethodImplementation impl = method.getImplementation(); if (impl != null) { return impl.getRegisterCount(); } return 0; }
@Nonnull @Override public List<? extends MethodParameter> getParameters() { return method.getParameters(); }
@Nonnull @Override public String getReturnType() { return method.getReturnType(); }
@Nonnull @Override public Set<? extends Annotation> getAnnotations() { return method.getAnnotations(); }
/** * Returns true if this class is an interface. * * If this class is not defined, then this will throw an UnresolvedClassException * * @return True if this class is an interface */ public boolean isInterface() { ClassDef classDef = getClassDef(); return (classDef.getAccessFlags() & AccessFlags.INTERFACE.getValue()) != 0; }
@Nonnull @Override public List<? extends CharSequence> getParameterTypes() { return method.getParameterTypes(); }
@Nullable @Override public String getSuperclass() { return getClassDef().getSuperclass(); }