public FieldInfo(ClassInfo info, Field field) { super(field); this.declaringClass = info; this.name = field.getName(); this.type = Type.getType(field.getType()).getDescriptor(); this.field = field; }
public AllParameterNamesDiscoveringVisitor(Class type) { super(Opcodes.ASM7); this.methodName = "<init>"; List<Constructor> constructors = new ArrayList<Constructor>(Arrays.asList(type.getConstructors())); constructors.addAll(Arrays.asList(type.getDeclaredConstructors())); for (Constructor constructor : constructors) { Type[] types = new Type[constructor.getParameterTypes().length]; for (int j = 0; j < types.length; j++) { types[j] = Type.getType(constructor.getParameterTypes()[j]); } constructorMap.put(Type.getMethodDescriptor(Type.VOID_TYPE, types), constructor); } }
public AnnotationInfo(Annotation annotation) { this(Type.getType(annotation.annotationType()).getDescriptor()); }
public Annotatable(AnnotatedElement element) { for (Annotation annotation : getAnnotations(element)) { annotations.add(new AnnotationInfo(Type.getType(annotation.annotationType()).getDescriptor())); } }
public AnnotationInfo(String name) { final Type type = Type.getType(name); name = type.getClassName(); if (name == null) { name = type.getDescriptor(); // name was already a class name } this.name = name; }
public String getType() { // if this method starts to be used internally move this to constructors and just return type final Type t = Type.getType(type); if (t.getClassName() == null) { return t.getDescriptor(); } return t.getClassName(); }
for (int i = 0; i < exceptionTypes.length; i++) exceptionTypeNames[i] = Type.getType(exceptionTypes[i]).getInternalName(); for (Class<?> aClass : delegatedMethod.getParameterTypes()) Type type = Type.getType(aClass); mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset); offset += type.getSize(); Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass()); if (!abstractMethod)
for (int i = 0; i < exceptionTypes.length; i++) exceptionTypeNames[i] = Type.getType(exceptionTypes[i]).getInternalName(); for (Class<?> aClass : delegatedMethod.getParameterTypes()) Type type = Type.getType(aClass); mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset); offset += type.getSize(); Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass()); boolean isItf = delegatedMethod.getDeclaringClass().isInterface(); mv.visitMethodInsn(
for (int i = 0; i < exceptionTypes.length; i++) exceptionTypeNames[i] = Type.getType(exceptionTypes[i]).getInternalName(); for (Class<?> aClass : delegatedMethod.getParameterTypes()) Type type = Type.getType(aClass); mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset); offset += type.getSize(); Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass()); boolean interfaceMethod = Modifier.isInterface(delegatedMethod.getDeclaringClass().getModifiers()); mv.visitMethodInsn(interfaceMethod ? Opcodes.INVOKEINTERFACE : Opcodes.INVOKEVIRTUAL,
@Override protected void createSerialisation(ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName) { String[] exceptionTypeNames = {Type.getType(ObjectStreamException.class).getInternalName()}; MethodVisitor mv = cw.visitMethod(Modifier.PUBLIC, "writeReplace", "()Ljava/lang/Object;", null, exceptionTypeNames); // fill method body mv.visitCode(); // load the contextual instance Provider mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_INTERCEPTOR_HANDLER, Type.getDescriptor(InterceptorHandler.class)); mv.visitInsn(Opcodes.ARETURN); mv.visitMaxs(-1, -1); mv.visitEnd(); }
@Override protected void createSerialisation(ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName) { String[] exceptionTypeNames = {Type.getType(ObjectStreamException.class).getInternalName()}; MethodVisitor mv = cw.visitMethod(Modifier.PUBLIC, "writeReplace", "()Ljava/lang/Object;", null, exceptionTypeNames); // fill method body mv.visitCode(); // load the contextual instance Provider mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_INSTANCE_PROVIDER, Type.getDescriptor(Provider.class)); mv.visitInsn(Opcodes.ARETURN); mv.visitMaxs(-1, -1); mv.visitEnd(); }
mv.visitLdcInsn(Type.getType("L" + classNameToOverride + ";")); mv.visitFieldInsn(GETSTATIC, wrapperType, "TYPE", "Ljava/lang/Class;"); } else { mv.visitLdcInsn(Type.getType(parameterType)); Class<?> exceptionType = exceptionTypes[i]; mv.visitLdcInsn(Type.getType("L" + exceptionType.getCanonicalName().replace('.', '/') + ";")); mv.visitVarInsn(ALOAD, length); mv
private void createSerialisation(final ClassWriter cw, final String pluginId, final String key) { final MethodVisitor mv = cw .visitMethod(Modifier.PUBLIC, "writeReplace", "()Ljava/lang/Object;", null, new String[] { Type.getType(ObjectStreamException.class).getInternalName() }); mv.visitCode(); mv.visitTypeInsn(NEW, "org/talend/sdk/component/runtime/serialization/SerializableService"); mv.visitInsn(DUP); mv.visitLdcInsn(pluginId); mv.visitLdcInsn(key); mv .visitMethodInsn(INVOKESPECIAL, "org/talend/sdk/component/runtime/serialization/SerializableService", "<init>", "(Ljava/lang/String;Ljava/lang/String;)V", false); mv.visitInsn(ARETURN); mv.visitMaxs(-1, -1); mv.visitEnd(); }
mv.visitLdcInsn(Type.getType("L" + classNameToOverride + ";")); mv.visitLdcInsn(Type.getType(parameterType)); mv.visitLdcInsn(Type.getType("L" + exceptionType.getCanonicalName().replace('.', '/') + ";")); mv.visitVarInsn(Opcodes.ALOAD, length); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/reflect/InvocationTargetException", "getCause",