public byte[] createTokenizer(final String[] httpVerbs, String[] httpVersions, String[] standardHeaders) { final String className = existingClassName + CLASS_NAME_SUFFIX; final ClassFile file = new ClassFile(className, existingClassName); final ClassMethod ctor = file.addMethod(AccessFlag.PUBLIC, "<init>", "V", DescriptorUtils.parameterDescriptors(constructorDescriptor)); ctor.getCodeAttribute().aload(0); ctor.getCodeAttribute().loadMethodParameters(); ctor.getCodeAttribute().invokespecial(existingClassName, "<init>", constructorDescriptor); ctor.getCodeAttribute().returnInstruction(); final ClassMethod sctor = file.addMethod(AccessFlag.PUBLIC | AccessFlag.STATIC, "<clinit>", "V"); final AtomicInteger fieldCounter = new AtomicInteger(1); sctor.getCodeAttribute().invokestatic(existingClassName, "httpStrings", "()" + DescriptorUtils.makeDescriptor(Map.class)); sctor.getCodeAttribute().astore(CONSTRUCTOR_HTTP_STRING_MAP_VAR); createStateMachines(httpVerbs, httpVersions, standardHeaders, className, file, sctor, fieldCounter); sctor.getCodeAttribute().returnInstruction(); return file.toBytecode(); }
public void invokespecial(Method method) { if (Modifier.isStatic(method.getModifiers())) { throw new InvalidBytecodeException("Cannot use invokespacial to invoke a static method"); } invokespecial(method.getDeclaringClass().getName(), method.getName(), DescriptorUtils.methodDescriptor(method), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); }
public void invokestatic(Method method) { if (!Modifier.isStatic(method.getModifiers())) { throw new InvalidBytecodeException("Cannot use invokestatic to invoke a non static method"); } invokestatic(method.getDeclaringClass().getName(), method.getName(), DescriptorUtils.methodDescriptor(method), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); }
public void invokespecial(Method method) { if (Modifier.isStatic(method.getModifiers())) { throw new InvalidBytecodeException("Cannot use invokespacial to invoke a static method"); } invokespecial(method.getDeclaringClass().getName(), method.getName(), DescriptorUtils.methodDescriptor(method), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); }
public void invokestatic(Method method) { if (!Modifier.isStatic(method.getModifiers())) { throw new InvalidBytecodeException("Cannot use invokestatic to invoke a non static method"); } invokestatic(method.getDeclaringClass().getName(), method.getName(), DescriptorUtils.methodDescriptor(method), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); }
public void invokeinterface(Method method) { if (Modifier.isStatic(method.getModifiers())) { throw new InvalidBytecodeException("Cannot use invokeinterface to invoke a static method"); } else if (Modifier.isPrivate(method.getModifiers())) { throw new InvalidBytecodeException("Cannot use invokeinterface to invoke a private method"); } else if (!method.getDeclaringClass().isInterface()) { throw new InvalidBytecodeException("Cannot use invokeinterface to invoke a non interface method"); } invokeinterface(method.getDeclaringClass().getName(), method.getName(), DescriptorUtils.methodDescriptor(method), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); }
public void invokeinterface(Method method) { if (Modifier.isStatic(method.getModifiers())) { throw new InvalidBytecodeException("Cannot use invokeinterface to invoke a static method"); } else if (Modifier.isPrivate(method.getModifiers())) { throw new InvalidBytecodeException("Cannot use invokeinterface to invoke a private method"); } else if (!method.getDeclaringClass().isInterface()) { throw new InvalidBytecodeException("Cannot use invokeinterface to invoke a non interface method"); } invokeinterface(method.getDeclaringClass().getName(), method.getName(), DescriptorUtils.methodDescriptor(method), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); }
public void invokevirtual(Method method) { if (Modifier.isStatic(method.getModifiers())) { throw new InvalidBytecodeException("Cannot use invokevirtual to invoke a static method"); } else if (Modifier.isPrivate(method.getModifiers())) { throw new InvalidBytecodeException("Cannot use invokevirtual to invoke a private method"); } else if (method.getDeclaringClass().isInterface()) { throw new InvalidBytecodeException("Cannot use invokevirtual to invoke an interface method"); } invokevirtual(method.getDeclaringClass().getName(), method.getName(), DescriptorUtils.methodDescriptor(method), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); }
@SuppressWarnings("unchecked") private void createDelegateMethod(ClassFile proxyClassType, Method method, MethodInformation methodInformation) { int modifiers = (method.getModifiers() | AccessFlag.SYNTHETIC | AccessFlag.PRIVATE) & ~AccessFlag.PUBLIC & ~AccessFlag.PROTECTED; ClassMethod delegatingMethod = proxyClassType.addMethod(modifiers, method.getName() + SUPER_DELEGATE_SUFFIX, DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method.getParameterTypes())); delegatingMethod.addCheckedExceptions((Class<? extends Exception>[]) method.getExceptionTypes()); createDelegateToSuper(delegatingMethod, methodInformation); }
@SuppressWarnings("unchecked") private void createDelegateMethod(ClassFile proxyClassType, Method method, MethodInformation methodInformation) { int modifiers = (method.getModifiers() | AccessFlag.SYNTHETIC | AccessFlag.PRIVATE) & ~AccessFlag.PUBLIC & ~AccessFlag.PROTECTED; ClassMethod delegatingMethod = proxyClassType.addMethod(modifiers, method.getName() + SUPER_DELEGATE_SUFFIX, DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method.getParameterTypes())); delegatingMethod.addCheckedExceptions((Class<? extends Exception>[]) method.getExceptionTypes()); createDelegateToSuper(delegatingMethod, methodInformation); }
@SuppressWarnings("unchecked") private void createDelegateMethod(ClassFile proxyClassType, Method method, MethodInformation methodInformation) { int modifiers = (method.getModifiers() | AccessFlag.SYNTHETIC | AccessFlag.PRIVATE) & ~AccessFlag.PUBLIC & ~AccessFlag.PROTECTED; ClassMethod delegatingMethod = proxyClassType.addMethod(modifiers, method.getName() + SUPER_DELEGATE_SUFFIX, DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method.getParameterTypes())); delegatingMethod.addCheckedExceptions((Class<? extends Exception>[]) method.getExceptionTypes()); createDelegateToSuper(delegatingMethod, methodInformation); }
public void invokestatic(String className, String methodName, String descriptor) { String[] params = DescriptorUtils.parameterDescriptors(descriptor); String returnType = DescriptorUtils.returnType(descriptor); invokestatic(className, methodName, descriptor, returnType, params); }
public void invokeinterface(String className, String methodName, String descriptor) { String[] params = DescriptorUtils.parameterDescriptors(descriptor); String returnType = DescriptorUtils.returnType(descriptor); invokeinterface(className, methodName, descriptor, returnType, params); }
public void invokestatic(String className, String methodName, String descriptor) { String[] params = DescriptorUtils.parameterDescriptors(descriptor); String returnType = DescriptorUtils.returnType(descriptor); invokestatic(className, methodName, descriptor, returnType, params); }
public void invokevirtual(String className, String methodName, String descriptor) { String[] params = DescriptorUtils.parameterDescriptors(descriptor); String returnType = DescriptorUtils.returnType(descriptor); invokevirtual(className, methodName, descriptor, returnType, params); }
public void invokeinterface(String className, String methodName, String descriptor) { String[] params = DescriptorUtils.parameterDescriptors(descriptor); String returnType = DescriptorUtils.returnType(descriptor); invokeinterface(className, methodName, descriptor, returnType, params); }
public void invokespecial(String className, String methodName, String descriptor) { String[] params = DescriptorUtils.parameterDescriptors(descriptor); String returnType = DescriptorUtils.returnType(descriptor); invokespecial(className, methodName, descriptor, returnType, params); }
public void invokeinterface(String className, String methodName, String descriptor) { String[] params = DescriptorUtils.parameterDescriptors(descriptor); String returnType = DescriptorUtils.returnType(descriptor); invokeinterface(className, methodName, descriptor, returnType, params); }
public void invokespecial(String className, String methodName, String descriptor) { String[] params = DescriptorUtils.parameterDescriptors(descriptor); String returnType = DescriptorUtils.returnType(descriptor); invokespecial(className, methodName, descriptor, returnType, params); }
public void invokespecial(String className, String methodName, String descriptor) { String[] params = DescriptorUtils.parameterDescriptors(descriptor); String returnType = DescriptorUtils.returnType(descriptor); invokespecial(className, methodName, descriptor, returnType, params); }