IntrabandProxyUtil { protected static void rewriteGetProxyMethodSignaturesMethodNode( ClassNode classNode, String[] proxyMethodSignatures) { MethodNode methodNode = ASMUtil.findMethodNode( classNode.methods, "_getProxyMethodSignatures", _STRING_ARRAY_TYPE); InsnList insnList = methodNode.instructions; insnList.clear(); MethodNodeGenerator methodNodeGenerator = new MethodNodeGenerator( methodNode); methodNodeGenerator.push(proxyMethodSignatures.length); methodNodeGenerator.newArray(_STRING_TYPE); for (int i = 0; i < proxyMethodSignatures.length; i++) { methodNodeGenerator.dup(); methodNodeGenerator.push(i); methodNodeGenerator.push(proxyMethodSignatures[i]); methodNodeGenerator.arrayStore(_STRING_TYPE); } methodNodeGenerator.returnValue(); methodNodeGenerator.endMethod(); }  static String[] getProxyMethodSignatures(Class<?> clazz); static Class<?> getStubClass(Class<?> clazz, String skeletonId); static Class<?> getStubClass(
		ClassLoader classLoader, Class<?> clazz, String skeletonId); static T newStubInstance(
		Class<? extends T> stubClass, String id,
		RegistrationReference registrationReference,
		ExceptionHandler exceptionHandler); static final String SKELETON_POSTFIX; static final String STUB_POSTFIX; }
@Test public void testRewriteGetProxyMethodSignaturesMethodNode() { class TestClass { @SuppressWarnings("unused") public final String[] PROXY_METHOD_SIGNATURES = _getProxyMethodSignatures(); private String[] _getProxyMethodSignatures() { return new String[0]; } } ClassNode classNode = _loadClass(TestClass.class); String[] proxyMethodSignatures = {"testSignature1", "testSignature2", "testSignature3"}; IntrabandProxyUtil.rewriteGetProxyMethodSignaturesMethodNode( classNode, proxyMethodSignatures); MethodNode methodNode = ASMUtil.findMethodNode( classNode.methods, "_getProxyMethodSignatures", Type.getType(String[].class)); InsnList insnList = methodNode.instructions; Iterator<AbstractInsnNode> iterator = insnList.iterator(); _assertInsnNode(iterator.next(), Opcodes.ICONST_3); _assertTypeInsnNode(iterator.next(), Opcodes.ANEWARRAY, String.class); for (int i = 0; i < proxyMethodSignatures.length; i++) { _assertInsnNode(iterator.next(), Opcodes.DUP); _assertInsnNode(iterator.next(), Opcodes.ICONST_0 + i); _assertLdcInsnNode( iterator.next(), Opcodes.LDC, proxyMethodSignatures[i]); _assertInsnNode(iterator.next(), Opcodes.AASTORE); } _assertInsnNode(iterator.next(), Opcodes.ARETURN); Assert.assertFalse(iterator.hasNext()); }