sc.ldc("ISO-8859-1"); sc.invokevirtual(String.class.getName(), "getBytes", "(Ljava/lang/String;)[B"); sc.putstatic(file.getName(), state.fieldName, "[B"); sc.aload(CONSTRUCTOR_HTTP_STRING_MAP_VAR); if (state.terminalState != null) { sc.ldc(state.terminalState); BranchEnd end = sc.ifnull(); sc.checkcast(HTTP_STRING_CLASS); sc.putstatic(file.getName(), state.httpStringFieldName, HTTP_STRING_DESCRIPTOR); BranchEnd done = sc.gotoInstruction(); sc.branchEnd(end); sc.putstatic(file.getName(), state.httpStringFieldName, HTTP_STRING_DESCRIPTOR); sc.branchEnd(done);
final CodeAttribute ca = asm.addMethod(m).getCodeAttribute(); ca.aload(0); ca.ldc(idlName); ca.getstatic(asm.getName(), strategyField, StubStrategy.class); if (!type.isPrimitive()) { ca.aload(index); } else if (type.equals(double.class)) { ca.dload(index); ca.checkcast(returnType); ca.returnInstruction(); final CodeAttribute init = asm.addMethod(Modifier.PRIVATE + Modifier.STATIC,initMethod, "V").getCodeAttribute(); int i; int len; init.putstatic(asm.getName(), strategyField, StubStrategy.class); init.returnInstruction();
c.aload(PARSE_STATE_VAR); c.getfield(parseStateClass, "leftOver", "B"); c.dup(); c.aload(BYTE_BUFFER_VAR); c.invokevirtual(ByteBuffer.class.getName(), "get", "()B"); BranchEnd cont = c.gotoInstruction(); c.branchEnd(end); c.aload(PARSE_STATE_VAR); c.iconst(0); c.putfield(parseStateClass, "leftOver", "B"); c.getstatic(file.getName(), currentState.httpStringFieldName, HTTP_STRING_DESCRIPTOR); stateMachine.handleStateMachineMatchedToken(c); c.invokevirtual(parseStateClass, "parseComplete", "()V"); c.iconst(0); c.returnInstruction();
/** * Client proxies use the following hashCode: * <code>MyProxyName.class.hashCode()</code> */ @Override protected void generateHashCodeMethod(ClassFile proxyClassType) { final ClassMethod method = proxyClassType.addMethod(AccessFlag.PUBLIC, HASH_CODE_METHOD, BytecodeUtils.INT_CLASS_DESCRIPTOR); final CodeAttribute b = method.getCodeAttribute(); // MyProxyName.class.hashCode() b.loadClass(proxyClassType.getName()); // now we have the class object on top of the stack b.invokevirtual("java.lang.Object", HASH_CODE_METHOD, EMPTY_PARENTHESES + BytecodeUtils.INT_CLASS_DESCRIPTOR); // now we have the hashCode b.returnInstruction(); }
@Override public void getDeclaredMethod(final ClassMethod classMethod, final String declaringClass, final String methodName, final String[] parameterTypes, ClassMethod staticConstructor) { String weldMemberName = WELD_MEMBER_PREFIX + METHOD_COUNT.incrementAndGet(); staticConstructor.getClassFile().addField(AccessFlag.PRIVATE | AccessFlag.STATIC, weldMemberName, LJAVA_LANG_REFLECT_METHOD); final CodeAttribute code = staticConstructor.getCodeAttribute(); addInitMethod(declaringClass, methodName, parameterTypes, weldMemberName, staticConstructor.getClassFile()); code.invokestatic(staticConstructor.getClassFile().getName(), weldMemberName, "()Ljava/lang/reflect/Method;"); code.putstatic(classMethod.getClassFile().getName(), weldMemberName, LJAVA_LANG_REFLECT_METHOD); CodeAttribute methodCode = classMethod.getCodeAttribute(); methodCode.getstatic(classMethod.getClassFile().getName(), weldMemberName, LJAVA_LANG_REFLECT_METHOD); }
/** * Client proxies are equal to other client proxies for the same bean. * <p/> * The corresponding java code: <code> * return other instanceof MyProxyClassType.class * </code> */ @Override protected void generateEqualsMethod(ClassFile proxyClassType) { ClassMethod method = proxyClassType.addMethod(AccessFlag.PUBLIC, "equals", BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR, LJAVA_LANG_OBJECT); CodeAttribute b = method.getCodeAttribute(); b.aload(1); b.instanceofInstruction(proxyClassType.getName()); b.returnInstruction(); }
/** * Client proxies use the following hashCode: * <code>MyProxyName.class.hashCode()</code> */ @Override protected void generateHashCodeMethod(ClassFile proxyClassType) { final ClassMethod method = proxyClassType.addMethod(AccessFlag.PUBLIC, HASH_CODE_METHOD, BytecodeUtils.INT_CLASS_DESCRIPTOR); final CodeAttribute b = method.getCodeAttribute(); // MyProxyName.class.hashCode() b.loadClass(proxyClassType.getName()); // now we have the class object on top of the stack b.invokevirtual("java.lang.Object", HASH_CODE_METHOD, EMPTY_PARENTHESES + BytecodeUtils.INT_CLASS_DESCRIPTOR); // now we have the hashCode b.returnInstruction(); }
@Override public void getDeclaredMethod(final ClassMethod classMethod, final String declaringClass, final String methodName, final String[] parameterTypes, ClassMethod staticConstructor) { String weldMemberName = WELD_MEMBER_PREFIX + METHOD_COUNT.incrementAndGet(); staticConstructor.getClassFile().addField(AccessFlag.PRIVATE | AccessFlag.STATIC, weldMemberName, LJAVA_LANG_REFLECT_METHOD); final CodeAttribute code = staticConstructor.getCodeAttribute(); addInitMethod(declaringClass, methodName, parameterTypes, weldMemberName, staticConstructor.getClassFile()); code.invokestatic(staticConstructor.getClassFile().getName(), weldMemberName, "()Ljava/lang/reflect/Method;"); code.putstatic(classMethod.getClassFile().getName(), weldMemberName, LJAVA_LANG_REFLECT_METHOD); CodeAttribute methodCode = classMethod.getCodeAttribute(); methodCode.getstatic(classMethod.getClassFile().getName(), weldMemberName, LJAVA_LANG_REFLECT_METHOD); }
/** * Client proxies are equal to other client proxies for the same bean. * <p/> * The corresponding java code: <code> * return other instanceof MyProxyClassType.class * </code> */ @Override protected void generateEqualsMethod(ClassFile proxyClassType) { ClassMethod method = proxyClassType.addMethod(AccessFlag.PUBLIC, "equals", BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR, LJAVA_LANG_OBJECT); CodeAttribute b = method.getCodeAttribute(); b.aload(1); b.instanceofInstruction(proxyClassType.getName()); b.returnInstruction(); }
/** * Client proxies use the following hashCode: * <code>MyProxyName.class.hashCode()</code> */ @Override protected void generateHashCodeMethod(ClassFile proxyClassType) { final ClassMethod method = proxyClassType.addMethod(AccessFlag.PUBLIC, HASH_CODE_METHOD, BytecodeUtils.INT_CLASS_DESCRIPTOR); final CodeAttribute b = method.getCodeAttribute(); // MyProxyName.class.hashCode() b.loadClass(proxyClassType.getName()); // now we have the class object on top of the stack b.invokevirtual("java.lang.Object", HASH_CODE_METHOD, EMPTY_PARENTHESES + BytecodeUtils.INT_CLASS_DESCRIPTOR); // now we have the hashCode b.returnInstruction(); }
@Override public void getDeclaredMethod(final ClassMethod classMethod, final String declaringClass, final String methodName, final String[] parameterTypes, ClassMethod staticConstructor) { String weldMemberName = WELD_MEMBER_PREFIX + METHOD_COUNT.incrementAndGet(); staticConstructor.getClassFile().addField(AccessFlag.PRIVATE | AccessFlag.STATIC, weldMemberName, LJAVA_LANG_REFLECT_METHOD); final CodeAttribute code = staticConstructor.getCodeAttribute(); addInitMethod(declaringClass, methodName, parameterTypes, weldMemberName, staticConstructor.getClassFile()); code.invokestatic(staticConstructor.getClassFile().getName(), weldMemberName, "()Ljava/lang/reflect/Method;"); code.putstatic(classMethod.getClassFile().getName(), weldMemberName, LJAVA_LANG_REFLECT_METHOD); CodeAttribute methodCode = classMethod.getCodeAttribute(); methodCode.getstatic(classMethod.getClassFile().getName(), weldMemberName, LJAVA_LANG_REFLECT_METHOD); }
/** * Client proxies are equal to other client proxies for the same bean. * <p/> * The corresponding java code: <code> * return other instanceof MyProxyClassType.class * </code> */ @Override protected void generateEqualsMethod(ClassFile proxyClassType) { ClassMethod method = proxyClassType.addMethod(AccessFlag.PUBLIC, "equals", BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR, LJAVA_LANG_OBJECT); CodeAttribute b = method.getCodeAttribute(); b.aload(1); b.instanceofInstruction(proxyClassType.getName()); b.returnInstruction(); }
/** * Client proxies use the following hashCode: * <code>MyProxyName.class.hashCode()</code> */ @Override protected void generateHashCodeMethod(ClassFile proxyClassType) { final ClassMethod method = proxyClassType.addMethod(AccessFlag.PUBLIC, HASH_CODE_METHOD, BytecodeUtils.INT_CLASS_DESCRIPTOR); final CodeAttribute b = method.getCodeAttribute(); // MyProxyName.class.hashCode() b.loadClass(proxyClassType.getName()); // now we have the class object on top of the stack b.invokevirtual("java.lang.Object", HASH_CODE_METHOD, EMPTY_PARENTHESES + BytecodeUtils.INT_CLASS_DESCRIPTOR); // now we have the hashCode b.returnInstruction(); }
@Override public void getDeclaredMethod(final ClassMethod classMethod, final String declaringClass, final String methodName, final String[] parameterTypes, ClassMethod staticConstructor) { String weldMemberName = WELD_MEMBER_PREFIX + METHOD_COUNT.incrementAndGet(); staticConstructor.getClassFile().addField(AccessFlag.PRIVATE | AccessFlag.STATIC, weldMemberName, LJAVA_LANG_REFLECT_METHOD); final CodeAttribute code = staticConstructor.getCodeAttribute(); addInitMethod(declaringClass, methodName, parameterTypes, weldMemberName, staticConstructor.getClassFile()); code.invokestatic(staticConstructor.getClassFile().getName(), weldMemberName, "()Ljava/lang/reflect/Method;"); code.putstatic(classMethod.getClassFile().getName(), weldMemberName, LJAVA_LANG_REFLECT_METHOD); CodeAttribute methodCode = classMethod.getCodeAttribute(); methodCode.getstatic(classMethod.getClassFile().getName(), weldMemberName, LJAVA_LANG_REFLECT_METHOD); }
/** * Client proxies are equal to other client proxies for the same bean. * <p/> * The corresponding java code: <code> * return other instanceof MyProxyClassType.class * </code> */ @Override protected void generateEqualsMethod(ClassFile proxyClassType) { ClassMethod method = proxyClassType.addMethod(AccessFlag.PUBLIC, "equals", BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR, LJAVA_LANG_OBJECT); CodeAttribute b = method.getCodeAttribute(); b.aload(1); b.instanceofInstruction(proxyClassType.getName()); b.returnInstruction(); }
/** * Client proxies use the following hashCode: * <code>MyProxyName.class.hashCode()</code> */ @Override protected void generateHashCodeMethod(ClassFile proxyClassType) { final ClassMethod method = proxyClassType.addMethod(AccessFlag.PUBLIC, HASH_CODE_METHOD, BytecodeUtils.INT_CLASS_DESCRIPTOR); final CodeAttribute b = method.getCodeAttribute(); // MyProxyName.class.hashCode() b.loadClass(proxyClassType.getName()); // now we have the class object on top of the stack b.invokevirtual("java.lang.Object", HASH_CODE_METHOD, EMPTY_PARENTHESES + BytecodeUtils.INT_CLASS_DESCRIPTOR); // now we have the hashCode b.returnInstruction(); }