asm.addField(Modifier.PRIVATE + Modifier.STATIC, strategyField, StubStrategy.class); final CodeAttribute ca = asm.addMethod(m).getCodeAttribute(); ca.aload(0); ca.ldc(idlName); ca.getstatic(asm.getName(), strategyField, StubStrategy.class); } else if (type.equals(double.class)) { ca.dload(index); Boxing.boxDouble(ca); index++; } else if (type.equals(long.class)) { ca.lload(index); Boxing.boxLong(ca); index++; } else if (type.equals(float.class)) { ca.fload(index); Boxing.boxFloat(ca); } else { ca.iload(index); Boxing.boxIfNessesary(ca, DescriptorUtils.makeDescriptor(type)); invoke += (Character.toUpperCase(typeName.charAt(0)) + typeName.substring(1)); ret = DescriptorUtils.makeDescriptor(returnType); ca.invokevirtual(superclass.getName(), invoke, "(Ljava/lang/String;Lorg/wildfly/iiop/openjdk/rmi/marshal/strategy/StubStrategy;[Ljava/lang/Object;)" + ret);
private void createInterceptedMethod(ClassMethod classMethod, final MethodInformation methodInfo, Method method, ClassMethod staticConstructor) { final CodeAttribute b = classMethod.getCodeAttribute(); b.aload(0); getMethodHandlerField(classMethod.getClassFile(), b); b.invokestatic(InterceptionDecorationContext.class.getName(), "getStack", "()" + DescriptorUtils.makeDescriptor(Stack.class)); b.aload(0); DEFAULT_METHOD_RESOLVER.getDeclaredMethod(classMethod, methodInfo.getDeclaringClass(), method.getName(), methodInfo.getParameterTypes(), staticConstructor); b.dup(); BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); if (methodInfo.getReturnType().equals(BytecodeUtils.VOID_CLASS_DESCRIPTOR)) { b.returnInstruction(); } else if (isPrimitive(methodInfo.getReturnType())) { Boxing.unbox(b, classMethod.getReturnType()); b.returnInstruction(); } else { b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType())); b.returnInstruction();
final CodeAttribute b = method.getCodeAttribute(); b.aload(0); getMethodHandlerField(method.getClassFile(), b); b.dup(); b.invokestatic(InterceptionDecorationContext.class.getName(), "getStack", "()" + DescriptorUtils.makeDescriptor(Stack.class)); if (!Reflections.isDefault(methodInfo.getMethod()) && !Modifier.isPrivate(method.getAccessFlags())) { "(" + DescriptorUtils.makeDescriptor(Stack.class) + ")" + BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR); b.invokespecial(methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getDescriptor()); staticConstructor); } else { bytecodeMethodResolver.getDeclaredMethod(method, method.getClassFile().getName(), methodInfo.getName() + SUPER_DELEGATE_SUFFIX, BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); Boxing.unbox(b,method.getReturnType()); b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType()));
private void invokePrivateMethodHandler(CodeAttribute b, ClassMethod classMethod, MethodInformation methodInfo, ClassMethod staticConstructor) { try { classMethod.getClassFile().addField(AccessFlag.PRIVATE, PRIVATE_METHOD_HANDLER_FIELD_NAME, MethodHandler.class); } catch (DuplicateMemberException ignored) { b.aload(0); b.getfield(classMethod.getClassFile().getName(), PRIVATE_METHOD_HANDLER_FIELD_NAME, DescriptorUtils.makeDescriptor(MethodHandler.class)); b.aload(0); DEFAULT_METHOD_RESOLVER.getDeclaredMethod(classMethod, methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getParameterTypes(), staticConstructor); b.iconst(i); BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); if (methodInfo.getReturnType().equals(BytecodeUtils.VOID_CLASS_DESCRIPTOR)) { } else if (isPrimitive(methodInfo.getReturnType())) { Boxing.unbox(b, methodInfo.getReturnType()); } else { b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType()));
private void createInterceptedMethod(ClassMethod classMethod, final MethodInformation methodInfo, Method method, ClassMethod staticConstructor) { final CodeAttribute b = classMethod.getCodeAttribute(); b.aload(0); getMethodHandlerField(classMethod.getClassFile(), b); b.invokestatic(InterceptionDecorationContext.class.getName(), "getStack", "()" + DescriptorUtils.makeDescriptor(Stack.class)); b.aload(0); DEFAULT_METHOD_RESOLVER.getDeclaredMethod(classMethod, methodInfo.getDeclaringClass(), method.getName(), methodInfo.getParameterTypes(), staticConstructor); b.dup(); BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); if (methodInfo.getReturnType().equals(BytecodeUtils.VOID_CLASS_DESCRIPTOR)) { b.returnInstruction(); } else if (isPrimitive(methodInfo.getReturnType())) { Boxing.unbox(b, classMethod.getReturnType()); b.returnInstruction(); } else { b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType())); b.returnInstruction();
final CodeAttribute b = method.getCodeAttribute(); b.aload(0); getMethodHandlerField(method.getClassFile(), b); b.dup(); b.invokestatic(InterceptionDecorationContext.class.getName(), "getStack", "()" + DescriptorUtils.makeDescriptor(Stack.class)); if (!Reflections.isDefault(methodInfo.getMethod()) && !Modifier.isPrivate(method.getAccessFlags())) { "(" + DescriptorUtils.makeDescriptor(Stack.class) + ")" + BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR); b.invokespecial(methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getDescriptor()); staticConstructor); } else { bytecodeMethodResolver.getDeclaredMethod(method, method.getClassFile().getName(), methodInfo.getName() + SUPER_DELEGATE_SUFFIX, BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); Boxing.unbox(b,method.getReturnType()); b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType()));
private void invokePrivateMethodHandler(CodeAttribute b, ClassMethod classMethod, MethodInformation methodInfo, ClassMethod staticConstructor) { try { classMethod.getClassFile().addField(AccessFlag.PRIVATE, PRIVATE_METHOD_HANDLER_FIELD_NAME, MethodHandler.class); } catch (DuplicateMemberException ignored) { b.aload(0); b.getfield(classMethod.getClassFile().getName(), PRIVATE_METHOD_HANDLER_FIELD_NAME, DescriptorUtils.makeDescriptor(MethodHandler.class)); b.aload(0); DEFAULT_METHOD_RESOLVER.getDeclaredMethod(classMethod, methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getParameterTypes(), staticConstructor); b.iconst(i); BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); if (methodInfo.getReturnType().equals(BytecodeUtils.VOID_CLASS_DESCRIPTOR)) { } else if (isPrimitive(methodInfo.getReturnType())) { Boxing.unbox(b, methodInfo.getReturnType()); } else { b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType()));
private void createNotInterceptedMethod(ClassMethod classMethod, final MethodInformation methodInfo, Method method, ClassMethod staticConstructor) { final CodeAttribute b = classMethod.getCodeAttribute(); b.aload(0); getMethodHandlerField(classMethod.getClassFile(), b); b.iconst(method.getParameterTypes().length); String typeString = methodInfo.getParameterTypes()[i]; b.dup(); // duplicate the array reference b.iconst(i); BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); if (methodInfo.getReturnType().equals(BytecodeUtils.VOID_CLASS_DESCRIPTOR)) { b.returnInstruction(); } else if (isPrimitive(methodInfo.getReturnType())) { Boxing.unbox(b, classMethod.getReturnType()); b.returnInstruction(); } else { b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType())); b.returnInstruction();
final CodeAttribute b = method.getCodeAttribute(); b.aload(0); getMethodHandlerField(method.getClassFile(), b); b.dup(); b.invokestatic(InterceptionDecorationContext.class.getName(), "getStack", "()" + DescriptorUtils.makeDescriptor(Stack.class)); if (!Reflections.isDefault(methodInfo.getMethod()) && !Modifier.isPrivate(method.getAccessFlags())) { "(" + DescriptorUtils.makeDescriptor(Stack.class) + ")" + BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR); b.invokespecial(methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getDescriptor()); staticConstructor); } else { bytecodeMethodResolver.getDeclaredMethod(method, method.getClassFile().getName(), methodInfo.getName() + SUPER_DELEGATE_SUFFIX, BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); Boxing.unbox(b,method.getReturnType()); b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType()));
private void invokePrivateMethodHandler(CodeAttribute b, ClassMethod classMethod, MethodInformation methodInfo, ClassMethod staticConstructor) { try { classMethod.getClassFile().addField(AccessFlag.PRIVATE, PRIVATE_METHOD_HANDLER_FIELD_NAME, MethodHandler.class); } catch (DuplicateMemberException ignored) { b.aload(0); b.getfield(classMethod.getClassFile().getName(), PRIVATE_METHOD_HANDLER_FIELD_NAME, DescriptorUtils.makeDescriptor(MethodHandler.class)); b.aload(0); DEFAULT_METHOD_RESOLVER.getDeclaredMethod(classMethod, methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getParameterTypes(), staticConstructor); b.iconst(i); BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); if (methodInfo.getReturnType().equals(BytecodeUtils.VOID_CLASS_DESCRIPTOR)) { } else if (isPrimitive(methodInfo.getReturnType())) { Boxing.unbox(b, methodInfo.getReturnType()); } else { b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType()));
asm.addField(Modifier.PRIVATE + Modifier.STATIC, strategyField, StubStrategy.class); final CodeAttribute ca = asm.addMethod(m).getCodeAttribute(); ca.aload(0); ca.ldc(idlName); ca.getstatic(asm.getName(), strategyField, StubStrategy.class); } else if (type.equals(double.class)) { ca.dload(index); Boxing.boxDouble(ca); index++; } else if (type.equals(long.class)) { ca.lload(index); Boxing.boxLong(ca); index++; } else if (type.equals(float.class)) { ca.fload(index); Boxing.boxFloat(ca); } else { ca.iload(index); Boxing.boxIfNessesary(ca, DescriptorUtils.makeDescriptor(type)); invoke += (Character.toUpperCase(typeName.charAt(0)) + typeName.substring(1)); ret = DescriptorUtils.makeDescriptor(returnType); ca.invokevirtual(superclass.getName(), invoke, "(Ljava/lang/String;Lorg/jboss/as/jacorb/rmi/marshal/strategy/StubStrategy;[Ljava/lang/Object;)" + ret);
private void createNotInterceptedMethod(ClassMethod classMethod, final MethodInformation methodInfo, Method method, ClassMethod staticConstructor) { final CodeAttribute b = classMethod.getCodeAttribute(); b.aload(0); getMethodHandlerField(classMethod.getClassFile(), b); b.iconst(method.getParameterTypes().length); String typeString = methodInfo.getParameterTypes()[i]; b.dup(); // duplicate the array reference b.iconst(i); BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); if (methodInfo.getReturnType().equals(BytecodeUtils.VOID_CLASS_DESCRIPTOR)) { b.returnInstruction(); } else if (isPrimitive(methodInfo.getReturnType())) { Boxing.unbox(b, classMethod.getReturnType()); b.returnInstruction(); } else { b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType())); b.returnInstruction();
final CodeAttribute b = method.getCodeAttribute(); b.aload(0); getMethodHandlerField(method.getClassFile(), b); b.dup(); b.invokestatic(InterceptionDecorationContext.class.getName(), "getStack", "()" + DescriptorUtils.makeDescriptor(Stack.class)); if (!Reflections.isDefault(methodInfo.getMethod()) && !Modifier.isPrivate(method.getAccessFlags())) { "(" + DescriptorUtils.makeDescriptor(Stack.class) + ")" + BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR); b.invokespecial(methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getDescriptor()); staticConstructor); } else { bytecodeMethodResolver.getDeclaredMethod(method, method.getClassFile().getName(), methodInfo.getName() + SUPER_DELEGATE_SUFFIX, BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); Boxing.unbox(b,method.getReturnType()); b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType()));
private void invokePrivateMethodHandler(CodeAttribute b, ClassMethod classMethod, MethodInformation methodInfo, ClassMethod staticConstructor) { try { classMethod.getClassFile().addField(AccessFlag.PRIVATE, PRIVATE_METHOD_HANDLER_FIELD_NAME, MethodHandler.class); } catch (DuplicateMemberException ignored) { b.aload(0); b.getfield(classMethod.getClassFile().getName(), PRIVATE_METHOD_HANDLER_FIELD_NAME, DescriptorUtils.makeDescriptor(MethodHandler.class)); b.aload(0); DEFAULT_METHOD_RESOLVER.getDeclaredMethod(classMethod, methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getParameterTypes(), staticConstructor); b.iconst(i); BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); if (methodInfo.getReturnType().equals(BytecodeUtils.VOID_CLASS_DESCRIPTOR)) { } else if (isPrimitive(methodInfo.getReturnType())) { Boxing.unbox(b, methodInfo.getReturnType()); } else { b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType()));
private void createInterceptedMethod(ClassMethod classMethod, final MethodInformation methodInfo, Method method, ClassMethod staticConstructor) { final CodeAttribute b = classMethod.getCodeAttribute(); b.aload(0); getMethodHandlerField(classMethod.getClassFile(), b); b.invokestatic(InterceptionDecorationContext.class.getName(), "getStack", "()" + DescriptorUtils.makeDescriptor(Stack.class)); b.aload(0); DEFAULT_METHOD_RESOLVER.getDeclaredMethod(classMethod, methodInfo.getDeclaringClass(), method.getName(), methodInfo.getParameterTypes(), staticConstructor); b.dup(); BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); if (methodInfo.getReturnType().equals(BytecodeUtils.VOID_CLASS_DESCRIPTOR)) { b.returnInstruction(); } else if (isPrimitive(methodInfo.getReturnType())) { Boxing.unbox(b, classMethod.getReturnType()); b.returnInstruction(); } else { b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType())); b.returnInstruction();
final CodeAttribute b = method.getCodeAttribute(); b.aload(0); getMethodHandlerField(method.getClassFile(), b); b.dup(); b.invokestatic(InterceptionDecorationContext.class.getName(), "getStack", "()" + DescriptorUtils.makeDescriptor(Stack.class)); if (!Reflections.isDefault(methodInfo.getMethod()) && !Modifier.isPrivate(method.getAccessFlags())) { b.dupX1(); // Handler, Stack -> Stack, Handler, Stack b.invokevirtual(COMBINED_INTERCEPTOR_AND_DECORATOR_STACK_METHOD_HANDLER_CLASS_NAME, "isDisabledHandler", "(" + DescriptorUtils.makeDescriptor(Stack.class) + ")" + BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR); b.invokespecial(methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getDescriptor()); staticConstructor); } else { bytecodeMethodResolver.getDeclaredMethod(method, method.getClassFile().getName(), methodInfo.getName() + SUPER_DELEGATE_SUFFIX, BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount); Boxing.boxIfNessesary(b, typeString); Boxing.unbox(b,method.getReturnType()); b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType()));