/** * Initialize from the given parsed bytecode. * For use by the owning project only. */ void read(BCClass orig) { try { ByteArrayInputStream in = new ByteArrayInputStream (orig.toByteArray()); read(in, orig.getClassLoader()); in.close(); } catch (IOException ioe) { throw new RuntimeException(ioe.toString()); } }
/** * Return the {@link Class} object for the superclass of this class, if it * is loadable. Returns null for types without superclasses. */ public Class getSuperclassType() { String name = getSuperclassName(); if (name == null) return null; return Strings.toClass(name, getClassLoader()); }
/** * Return the {@link Class} objects for the declared interfaces of this * class, or an empty array if none. */ public Class[] getDeclaredInterfaceTypes() { String[] names = getDeclaredInterfaceNames(); Class[] types = new Class[names.length]; for (int i = 0; i < names.length; i++) types[i] = Strings.toClass(names[i], getClassLoader()); return types; }
/** * Return the {@link Class} object for this class, if it is loadable. */ public Class getType() { return Strings.toClass(getName(), getClassLoader()); }
/** * Return the {@link Class} objects for the declared interfaces of this * class, or an empty array if none. */ public Class[] getDeclaredInterfaceTypes() { String[] names = getDeclaredInterfaceNames(); Class[] types = new Class[names.length]; for (int i = 0; i < names.length; i++) types[i] = Strings.toClass(names[i], getClassLoader()); return types; }
/** * Return the {@link Class} object for the superclass of this class, if it * is loadable. Returns null for types without superclasses. */ public Class getSuperclassType() { String name = getSuperclassName(); if (name == null) return null; return Strings.toClass(name, getClassLoader()); }
/** * Return the {@link Class} object for this class, if it is loadable. */ public Class getType() { return Strings.toClass(getName(), getClassLoader()); }
/** * Return the component type of this class, or null if not an array. */ public Class getComponentType() { String componentName = getComponentName(); if (componentName == null) return null; return Strings.toClass(componentName, getClassLoader()); }
/** * Return the component type of this class, or null if not an array. */ public Class getComponentType() { String componentName = getComponentName(); if (componentName == null) return null; return Strings.toClass(componentName, getClassLoader()); }
private static byte[] toJava7ByteArray(BCClass bc, byte[] classBytes) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(classBytes); BufferedInputStream bis = new BufferedInputStream(bais); ClassWriter cw = new BCClassWriter(ClassWriter.COMPUTE_FRAMES, bc.getClassLoader()); ClassReader cr = new ClassReader(bis); cr.accept(cw, 0); return cw.toByteArray(); }
private static byte[] toJava7ByteArray(BCClass bc, byte[] classBytes) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(classBytes); BufferedInputStream bis = new BufferedInputStream(bais); ClassWriter cw = new BCClassWriter(ClassWriter.COMPUTE_FRAMES, bc.getClassLoader()); ClassReader cr = new ClassReader(bis); cr.accept(cw, 0); return cw.toByteArray(); }
private static byte[] toJava7ByteArray(BCClass bc, byte[] classBytes) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(classBytes); BufferedInputStream bis = new BufferedInputStream(bais); ClassWriter cw = new BCClassWriter(ClassWriter.COMPUTE_FRAMES, bc.getClassLoader()); ClassReader cr = new ClassReader(bis); cr.accept(cw, 0); return cw.toByteArray(); }
private static byte[] toJava7ByteArray(BCClass bc, byte[] classBytes) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(classBytes); BufferedInputStream bis = new BufferedInputStream(bais); ClassWriter cw = new BCClassWriter(ClassWriter.COMPUTE_FRAMES, bc.getClassLoader()); ClassReader cr = new ClassReader(bis); cr.accept(cw, 0); return cw.toByteArray(); }
private static byte[] toJava7ByteArray(BCClass bc, byte[] classBytes) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(classBytes); BufferedInputStream bis = new BufferedInputStream(bais); ClassWriter cw = new BCClassWriter(ClassWriter.COMPUTE_FRAMES, bc.getClassLoader()); ClassReader cr = new ClassReader(bis); cr.accept(cw, 0); return cw.toByteArray(); }
/** * Return the bytecode of the superclass of this class, or * null for types without superclasses. */ public BCClass getSuperclassBC() { String name = getSuperclassName(); if (name == null) return null; return getProject().loadClass(name, getClassLoader()); }
/** * Return the component type of this class, or null if not an array. */ public BCClass getComponentBC() { String componentName = getComponentName(); if (componentName == null) return null; return getProject().loadClass(componentName, getClassLoader()); }
/** * Return the component type of this class, or null if not an array. */ public BCClass getComponentBC() { String componentName = getComponentName(); if (componentName == null) return null; return getProject().loadClass(componentName, getClassLoader()); }
/** * Return the bytecode for the declared interfaces of this class, or an * empty array if none. */ public BCClass[] getDeclaredInterfaceBCs() { String[] names = getDeclaredInterfaceNames(); BCClass[] types = new BCClass[names.length]; for (int i = 0; i < names.length; i++) types[i] = getProject().loadClass(names[i], getClassLoader()); return types; }
/** * Return the bytecode of the superclass of this class, or * null for types without superclasses. */ public BCClass getSuperclassBC() { String name = getSuperclassName(); if (name == null) return null; return getProject().loadClass(name, getClassLoader()); }
/** * Return the bytecode for the declared interfaces of this class, or an * empty array if none. */ public BCClass[] getDeclaredInterfaceBCs() { String[] names = getDeclaredInterfaceNames(); BCClass[] types = new BCClass[names.length]; for (int i = 0; i < names.length; i++) types[i] = getProject().loadClass(names[i], getClassLoader()); return types; }