public ClassField addField(Field field) { ClassField classField = addField((short) field.getModifiers(), field.getName(), field.getType(), null); for (Annotation annotation : field.getDeclaredAnnotations()) { classField.getRuntimeVisibleAnnotationsAttribute().addAnnotation( AnnotationBuilder.createAnnotation(constPool, annotation)); } return classField; }
public ClassFile(String name, int accessFlags, String superclass, String... interfaces) { this.version = JavaVersions.JAVA_6; this.name = name.replace('/', '.'); // store the name in . form this.superclass = superclass; this.accessFlags = accessFlags; this.interfaces.addAll(Arrays.asList(interfaces)); runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(AnnotationsAttribute.Type.RUNTIME_VISIBLE, constPool); this.attributes.add(runtimeVisibleAnnotationsAttribute); }
public ClassField addField(Field field) { ClassField classField = addField((short) field.getModifiers(), field.getName(), field.getType(), null); for (Annotation annotation : field.getDeclaredAnnotations()) { classField.getRuntimeVisibleAnnotationsAttribute().addAnnotation( AnnotationBuilder.createAnnotation(constPool, annotation)); } return classField; }
public ClassFile(String name, int accessFlags, String superclass, int version, ClassLoader classLoader, String... interfaces) { if(version > JavaVersions.JAVA_6 && classLoader == null) { throw new IllegalArgumentException("ClassLoader must be specified if version is greater than Java 6"); } this.version = version; this.classLoader = classLoader; this.name = name.replace('/', '.'); // store the name in . form this.superclass = superclass; this.accessFlags = accessFlags; this.interfaces.addAll(Arrays.asList(interfaces)); runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(AnnotationsAttribute.Type.RUNTIME_VISIBLE, constPool); this.attributes.add(runtimeVisibleAnnotationsAttribute); }
public ClassField addField(Field field) { ClassField classField = addField((short) field.getModifiers(), field.getName(), field.getType(), null); for (Annotation annotation : field.getDeclaredAnnotations()) { classField.getRuntimeVisibleAnnotationsAttribute().addAnnotation( AnnotationBuilder.createAnnotation(constPool, annotation)); } return classField; }
public ClassFile(String name, int accessFlags, String superclass, int version, ClassLoader classLoader, String... interfaces) { if(version > JavaVersions.JAVA_6 && classLoader == null) { throw new IllegalArgumentException("ClassLoader must be specified if version is greater than Java 6"); } this.version = version; this.classLoader = classLoader; this.name = name.replace('/', '.'); // store the name in . form this.superclass = superclass; this.accessFlags = accessFlags; this.interfaces.addAll(Arrays.asList(interfaces)); runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(AnnotationsAttribute.Type.RUNTIME_VISIBLE, constPool); this.attributes.add(runtimeVisibleAnnotationsAttribute); }
public ClassField addField(Field field) { ClassField classField = addField((short) field.getModifiers(), field.getName(), field.getType(), null); for (Annotation annotation : field.getDeclaredAnnotations()) { classField.getRuntimeVisibleAnnotationsAttribute().addAnnotation( AnnotationBuilder.createAnnotation(constPool, annotation)); } return classField; }
public ClassFile(String name, int accessFlags, String superclass, int version, ClassLoader classLoader, String... interfaces) { if(version > JavaVersions.JAVA_6 && classLoader == null) { throw new IllegalArgumentException("ClassLoader must be specified if version is greater than Java 6"); } this.version = version; this.classLoader = classLoader; this.name = name.replace('/', '.'); // store the name in . form this.superclass = superclass; this.accessFlags = accessFlags; this.interfaces.addAll(Arrays.asList(interfaces)); runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(AnnotationsAttribute.Type.RUNTIME_VISIBLE, constPool); this.attributes.add(runtimeVisibleAnnotationsAttribute); }
public ClassField addField(Field field) { ClassField classField = addField((short) field.getModifiers(), field.getName(), field.getType(), null); for (Annotation annotation : field.getDeclaredAnnotations()) { classField.getRuntimeVisibleAnnotationsAttribute().addAnnotation( AnnotationBuilder.createAnnotation(constPool, annotation)); } return classField; }
public ClassFile(String name, int accessFlags, String superclass, int version, ClassLoader classLoader, String... interfaces) { if(version > JavaVersions.JAVA_6 && classLoader == null) { throw new IllegalArgumentException("ClassLoader must be specified if version is greater than Java 6"); } this.version = version; this.classLoader = classLoader; this.name = name.replace('/', '.'); // store the name in . form this.superclass = superclass; this.accessFlags = accessFlags; this.interfaces.addAll(Arrays.asList(interfaces)); runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(AnnotationsAttribute.Type.RUNTIME_VISIBLE, constPool); this.attributes.add(runtimeVisibleAnnotationsAttribute); }
/** * Adds a method with the same signiture as the given method, including exception types * <p> * The new method will have the same modifier as the original method, except that the abstract and native flags will be * stripped. * <p> * TODO: annotations and signiture attribute */ public ClassMethod addMethod(Method method) { ClassMethod classMethod = addMethod(method.getModifiers() & (~AccessFlag.ABSTRACT) & (~AccessFlag.NATIVE), method .getName(), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); for (Class<?> e : method.getExceptionTypes()) { classMethod.addCheckedExceptions((Class<? extends Exception>) e); } for (Annotation annotation : method.getDeclaredAnnotations()) { classMethod.getRuntimeVisibleAnnotationsAttribute().addAnnotation( AnnotationBuilder.createAnnotation(constPool, annotation)); } int count = 0; for (Annotation[] parameterAnnotations : method.getParameterAnnotations()) { for (Annotation annotation : parameterAnnotations) { classMethod.getRuntimeVisibleParameterAnnotationsAttribute().addAnnotation(count, AnnotationBuilder.createAnnotation(constPool, annotation)); } count++; } return classMethod; }
ClassField(int accessFlags, String name, String descriptor, ClassFile classFile, ConstPool constPool) { this.accessFlags = accessFlags; this.name = name; this.descriptor = descriptor; this.classFile = classFile; this.nameIndex = constPool.addUtf8Entry(name); this.descriptorIndex = constPool.addUtf8Entry(descriptor); runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(AnnotationsAttribute.Type.RUNTIME_VISIBLE, constPool); this.attributes.add(runtimeVisibleAnnotationsAttribute); }
/** * Adds a method with the same signiture as the given method, including exception types * <p> * The new method will have the same modifier as the original method, except that the abstract and native flags will be * stripped. * <p> * TODO: annotations and signiture attribute */ public ClassMethod addMethod(Method method) { ClassMethod classMethod = addMethod(method.getModifiers() & (~AccessFlag.ABSTRACT) & (~AccessFlag.NATIVE), method .getName(), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); for (Class<?> e : method.getExceptionTypes()) { classMethod.addCheckedExceptions((Class<? extends Exception>) e); } for (Annotation annotation : method.getDeclaredAnnotations()) { classMethod.getRuntimeVisibleAnnotationsAttribute().addAnnotation( AnnotationBuilder.createAnnotation(constPool, annotation)); } int count = 0; for (Annotation[] parameterAnnotations : method.getParameterAnnotations()) { for (Annotation annotation : parameterAnnotations) { classMethod.getRuntimeVisibleParameterAnnotationsAttribute().addAnnotation(count, AnnotationBuilder.createAnnotation(constPool, annotation)); } count++; } return classMethod; }
ClassField(int accessFlags, String name, String descriptor, ClassFile classFile, ConstPool constPool) { this.accessFlags = accessFlags; this.name = name; this.descriptor = descriptor; this.classFile = classFile; this.nameIndex = constPool.addUtf8Entry(name); this.descriptorIndex = constPool.addUtf8Entry(descriptor); runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(AnnotationsAttribute.Type.RUNTIME_VISIBLE, constPool); this.attributes.add(runtimeVisibleAnnotationsAttribute); }
/** * Adds a method with the same signiture as the given method, including exception types * <p> * The new method will have the same modifier as the original method, except that the abstract and native flags will be * stripped. * <p> * TODO: annotations and signiture attribute */ public ClassMethod addMethod(Method method) { ClassMethod classMethod = addMethod(method.getModifiers() & (~AccessFlag.ABSTRACT) & (~AccessFlag.NATIVE), method .getName(), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); for (Class<?> e : method.getExceptionTypes()) { classMethod.addCheckedExceptions((Class<? extends Exception>) e); } for (Annotation annotation : method.getDeclaredAnnotations()) { classMethod.getRuntimeVisibleAnnotationsAttribute().addAnnotation( AnnotationBuilder.createAnnotation(constPool, annotation)); } int count = 0; for (Annotation[] parameterAnnotations : method.getParameterAnnotations()) { for (Annotation annotation : parameterAnnotations) { classMethod.getRuntimeVisibleParameterAnnotationsAttribute().addAnnotation(count, AnnotationBuilder.createAnnotation(constPool, annotation)); } count++; } return classMethod; }
ClassField(int accessFlags, String name, String descriptor, ClassFile classFile, ConstPool constPool) { this.accessFlags = accessFlags; this.name = name; this.descriptor = descriptor; this.classFile = classFile; this.nameIndex = constPool.addUtf8Entry(name); this.descriptorIndex = constPool.addUtf8Entry(descriptor); runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(AnnotationsAttribute.Type.RUNTIME_VISIBLE, constPool); this.attributes.add(runtimeVisibleAnnotationsAttribute); }
/** * Adds a method with the same signiture as the given method, including exception types * <p> * The new method will have the same modifier as the original method, except that the abstract and native flags will be * stripped. * <p> * TODO: annotations and signiture attribute */ public ClassMethod addMethod(Method method) { ClassMethod classMethod = addMethod(method.getModifiers() & (~AccessFlag.ABSTRACT) & (~AccessFlag.NATIVE), method .getName(), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); for (Class<?> e : method.getExceptionTypes()) { classMethod.addCheckedExceptions((Class<? extends Exception>) e); } for (Annotation annotation : method.getDeclaredAnnotations()) { classMethod.getRuntimeVisibleAnnotationsAttribute().addAnnotation( AnnotationBuilder.createAnnotation(constPool, annotation)); } int count = 0; for (Annotation[] parameterAnnotations : method.getParameterAnnotations()) { for (Annotation annotation : parameterAnnotations) { classMethod.getRuntimeVisibleParameterAnnotationsAttribute().addAnnotation(count, AnnotationBuilder.createAnnotation(constPool, annotation)); } count++; } return classMethod; }
ClassField(short accessFlags, String name, String descriptor, ClassFile classFile, ConstPool constPool) { this.accessFlags = accessFlags; this.name = name; this.descriptor = descriptor; this.classFile = classFile; this.nameIndex = constPool.addUtf8Entry(name); this.descriptorIndex = constPool.addUtf8Entry(descriptor); runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(AnnotationsAttribute.Type.RUNTIME_VISIBLE, constPool); this.attributes.add(runtimeVisibleAnnotationsAttribute); }
/** * Adds a method with the same signiture as the given method, including exception types * <p> * The new method will have the same modifier as the original method, except that the abstract and native flags will be * stripped. * <p> * TODO: annotations and signiture attribute */ public ClassMethod addMethod(Method method) { ClassMethod classMethod = addMethod(method.getModifiers() & (~AccessFlag.ABSTRACT) & (~AccessFlag.NATIVE), method .getName(), DescriptorUtils.makeDescriptor(method.getReturnType()), DescriptorUtils.parameterDescriptors(method .getParameterTypes())); for (Class<?> e : method.getExceptionTypes()) { classMethod.addCheckedExceptions((Class<? extends Exception>) e); } for (Annotation annotation : method.getDeclaredAnnotations()) { classMethod.getRuntimeVisibleAnnotationsAttribute().addAnnotation( AnnotationBuilder.createAnnotation(constPool, annotation)); } int count = 0; for (Annotation[] parameterAnnotations : method.getParameterAnnotations()) { for (Annotation annotation : parameterAnnotations) { classMethod.getRuntimeVisibleParameterAnnotationsAttribute().addAnnotation(count, AnnotationBuilder.createAnnotation(constPool, annotation)); } count++; } return classMethod; }
ClassField(int accessFlags, String name, String descriptor, ClassFile classFile, ConstPool constPool) { this.accessFlags = accessFlags; this.name = name; this.descriptor = descriptor; this.classFile = classFile; this.nameIndex = constPool.addUtf8Entry(name); this.descriptorIndex = constPool.addUtf8Entry(descriptor); runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(AnnotationsAttribute.Type.RUNTIME_VISIBLE, constPool); this.attributes.add(runtimeVisibleAnnotationsAttribute); }