/** * Converts a class name from the internal representation used in * the JVM to the normal one used in Java. */ public static String toJavaName(String classname) { return Descriptor.toJavaName(classname); } }
/** * Converts a class name from the internal representation used in * the JVM to the normal one used in Java. */ public static String toJavaName(String classname) { return Descriptor.toJavaName(classname); } }
private static String javaName(String name) { return Descriptor.toJavaName(Descriptor.toJvmName(name)); } }
private static String javaName(CtClass clazz) { return Descriptor.toJavaName(Descriptor.toJvmName(clazz)); }
private static String javaName(String name) { return Descriptor.toJavaName(Descriptor.toJvmName(name)); } }
private static String javaName(CtClass clazz) { return Descriptor.toJavaName(Descriptor.toJvmName(clazz)); }
/** * Reads <code>CONSTANT_Class_info</code> structure * at the given index. * * @return a fully-qualified class or interface name specified * by <code>name_index</code>. If the type is an array * type, this method returns an encoded name like * <code>[Ljava.lang.Object;</code> (note that the separators * are not slashes but dots). * @see javassist.ClassPool#getCtClass(String) */ public String getClassInfo(int index) { ClassInfo c = (ClassInfo)getItem(index); if (c == null) return null; else return Descriptor.toJavaName(getUtf8Info(c.name)); }
/** * Reads <code>CONSTANT_Class_info</code> structure * at the given index. * * @return a fully-qualified class or interface name specified * by <code>name_index</code>. If the type is an array * type, this method returns an encoded name like * <code>[Ljava.lang.Object;</code> (note that the separators * are not slashes but dots). * @see javassist.ClassPool#getCtClass(String) */ public String getClassInfo(int index) { ClassInfo c = (ClassInfo)getItem(index); if (c == null) return null; return Descriptor.toJavaName(getUtf8Info(c.name)); }
.toJvmName(thisclassname)); if (jvmNewThisName != null) thisclassname = Descriptor.toJavaName(jvmNewThisName);
throw new RuntimeException("cannot change " + Descriptor.toJavaName(name) + " into a static class");
public void replaceClassName(ClassMap classnames) throws RuntimeException { String oldClassName = getName(); String newClassName = (String)classnames.get(Descriptor.toJvmName(oldClassName)); if (newClassName != null) { newClassName = Descriptor.toJavaName(newClassName); // check this in advance although classNameChanged() below does. classPool.checkNotFrozen(newClassName); } super.replaceClassName(classnames); ClassFile cf = getClassFile2(); cf.renameClass(classnames); nameReplaced(); if (newClassName != null) { super.setName(newClassName); classPool.classNameChanged(oldClassName, this); } }
/** * Replaces all occurrences of several class names in the class file. * * @param classnames * specifies which class name is replaced with which new name. * Class names must be described with the JVM-internal * representation like <code>java/lang/Object</code>. * @see #renameClass(String,String) */ public final void renameClass(Map<String,String> classnames) { String jvmNewThisName = classnames.get(Descriptor .toJvmName(thisclassname)); if (jvmNewThisName != null) thisclassname = Descriptor.toJavaName(jvmNewThisName); constPool.renameClass(classnames); AttributeInfo.renameClass(attributes, classnames); for (MethodInfo minfo:methods) { String desc = minfo.getDescriptor(); minfo.setDescriptor(Descriptor.rename(desc, classnames)); AttributeInfo.renameClass(minfo.getAttributes(), classnames); } for (FieldInfo finfo:fields) { String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, classnames)); AttributeInfo.renameClass(finfo.getAttributes(), classnames); } }
@Override public void replaceClassName(ClassMap classnames) throws RuntimeException { String oldClassName = getName(); String newClassName = classnames.get(Descriptor.toJvmName(oldClassName)); if (newClassName != null) { newClassName = Descriptor.toJavaName(newClassName); // check this in advance although classNameChanged() below does. classPool.checkNotFrozen(newClassName); } super.replaceClassName(classnames); ClassFile cf = getClassFile2(); cf.renameClass(classnames); nameReplaced(); if (newClassName != null) { super.setName(newClassName); classPool.classNameChanged(oldClassName, this); } }
/** * Converts a class name from the internal representation used in * the JVM to the normal one used in Java. */ public static String toJavaName(String classname) { return Descriptor.toJavaName(classname); } }
/** * Converts a class name from the internal representation used in * the JVM to the normal one used in Java. */ public static String toJavaName(String classname) { return Descriptor.toJavaName(classname); } }
/** * Converts a class name from the internal representation used in * the JVM to the normal one used in Java. */ public static String toJavaName(String classname) { return Descriptor.toJavaName(classname); } }
void makeHashtable(ConstPool cp) { String name = Descriptor.toJavaName(getClassName(cp)); cp.classes.put(name, this); } }
private static String javaName(String name) { return Descriptor.toJavaName(Descriptor.toJvmName(name)); } }
void makeHashtable(ConstPool cp) { String name = Descriptor.toJavaName(getClassName(cp)); cp.classes.put(name, this); } }
private CodeBuilder insert(CtClass cc) { if (cc.isPrimitive()) { body.append(getPrimitiveJavaClassWrapper(cc).getName()) .append(".TYPE"); return this; } return insertObjectClass(Descriptor.toJavaName(Descriptor.toJvmName(cc))); }