/** * Renames the given class within this project. Used internally by * {@link BCClass} instances when their name is modified. * * @throws IllegalStateException if a class with the new name already exists */ void renameClass(String oldName, String newName, BCClass bc) { if (oldName.equals(newName)) return; BCClass cached = (BCClass) checkCache(newName); if (cached != null) throw new IllegalStateException("A class with name " + newName + " already exists in this project"); removeFromCache(oldName, bc); cache(newName, bc); }
/** * Renames the given class within this project. Used internally by * {@link BCClass} instances when their name is modified. * * @throws IllegalStateException if a class with the new name already exists */ void renameClass(String oldName, String newName, BCClass bc) { if (oldName.equals(newName)) return; BCClass cached = (BCClass) checkCache(newName); if (cached != null) throw new IllegalStateException("A class with name " + newName + " already exists in this project"); removeFromCache(oldName, bc); cache(newName, bc); }
cache(type.getName(), ret); return ret;
/** * Load the bytecode from the given stream. * If this project already contains the class in the given stream, * it will be returned. Otherwise a new {@link BCClass} will be created * from the given bytecode. * * @throws RuntimeException on parse error */ public BCClass loadClass(InputStream in, ClassLoader loader) { BCClass ret = new BCClass(this); ret.setState(new ObjectState(_names)); try { ret.read(in, loader); } catch (IOException ioe) { throw new RuntimeException(ioe.toString()); } String name = ret.getName(); BCClass cached = checkCache(name); if (cached != null) return cached; cache(name, ret); return ret; }
/** * Load the bytecode from the given class file. * If this project already contains the class in the given file, it will * be returned. Otherwise a new {@link BCClass} will be created from the * given bytecode. * * @throws RuntimeException on parse error */ public BCClass loadClass(File classFile, ClassLoader loader) { // parse the bytecode from the file BCClass ret = new BCClass(this); ret.setState(new ObjectState(_names)); try { ret.read(classFile, loader); } catch (IOException ioe) { throw new RuntimeException(ioe.toString()); } String name = ret.getName(); BCClass cached = checkCache(name); if (cached != null) return cached; cache(name, ret); return ret; }
cache(type.getName(), ret); return ret;
/** * Load the bytecode from the given stream. * If this project already contains the class in the given stream, * it will be returned. Otherwise a new {@link BCClass} will be created * from the given bytecode. * * @throws RuntimeException on parse error */ public BCClass loadClass(InputStream in, ClassLoader loader) { BCClass ret = new BCClass(this); ret.setState(new ObjectState(_names)); try { ret.read(in, loader); } catch (IOException ioe) { throw new RuntimeException(ioe.toString()); } String name = ret.getName(); BCClass cached = checkCache(name); if (cached != null) return cached; cache(name, ret); return ret; }
/** * Load the bytecode from the given class file. * If this project already contains the class in the given file, it will * be returned. Otherwise a new {@link BCClass} will be created from the * given bytecode. * * @throws RuntimeException on parse error */ public BCClass loadClass(File classFile, ClassLoader loader) { // parse the bytecode from the file BCClass ret = new BCClass(this); ret.setState(new ObjectState(_names)); try { ret.read(classFile, loader); } catch (IOException ioe) { throw new RuntimeException(ioe.toString()); } String name = ret.getName(); BCClass cached = checkCache(name); if (cached != null) return cached; cache(name, ret); return ret; }
ret.setSuperclass(Object.class); cache(name, ret); return ret;
ret.setSuperclass(Object.class); cache(name, ret); return ret;
/** * Import the given bytecode from another project. If a {@link BCClass} * with the same name already exists in this project, it will be returned. * Otherwise, a new {@link BCClass} will be created from the * information in the given class. */ public BCClass loadClass(BCClass bc) { String name = bc.getName(); BCClass cached = checkCache(name); if (cached != null) return cached; BCClass ret = new BCClass(this); if (bc.isPrimitive()) ret.setState(new PrimitiveState(bc.getType(), _names)); else if (bc.isArray()) ret.setState(new ArrayState(bc.getName(), bc.getComponentName())); else { ret.setState(new ObjectState(_names)); ret.read(bc); } cache(name, ret); return ret; }
/** * Import the given bytecode from another project. If a {@link BCClass} * with the same name already exists in this project, it will be returned. * Otherwise, a new {@link BCClass} will be created from the * information in the given class. */ public BCClass loadClass(BCClass bc) { String name = bc.getName(); BCClass cached = checkCache(name); if (cached != null) return cached; BCClass ret = new BCClass(this); if (bc.isPrimitive()) ret.setState(new PrimitiveState(bc.getType(), _names)); else if (bc.isArray()) ret.setState(new ArrayState(bc.getName(), bc.getComponentName())); else { ret.setState(new ObjectState(_names)); ret.read(bc); } cache(name, ret); return ret; }