/** * Sets the type of the field. * * <p>This method does not automatically update method bodies that access * this field. They have to be explicitly updated. For example, * if some method contains an expression {@code t.value} and the type * of the variable {@code t} is changed by {@link #setType(CtClass)} * from {@code int} to {@code double}, then {@code t.value} has to be modified * as well since the bytecode of {@code t.value} contains the type information. * </p> * * @see CodeConverter * @see javassist.expr.ExprEditor */ public void setType(CtClass clazz) { declaringClass.checkModify(); fieldInfo.setDescriptor(Descriptor.of(clazz)); }
/** * Sets the type of the field. * * <p>This method does not automatically update method bodies that access * this field. They have to be explicitly updated. For example, * if some method contains an expression {@code t.value} and the type * of the variable {@code t} is changed by {@link #setType(CtClass)} * from {@code int} to {@code double}, then {@code t.value} has to be modified * as well since the bytecode of {@code t.value} contains the type information. * </p> * * @see CodeConverter * @see javassist.expr.ExprEditor */ public void setType(CtClass clazz) { declaringClass.checkModify(); fieldInfo.setDescriptor(Descriptor.of(clazz)); }
FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, oldname, newname)); AttributeInfo.renameClass(finfo.getAttributes(), oldname, newname);
FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, classnames)); AttributeInfo.renameClass(finfo.getAttributes(), classnames);
finfo.setDescriptor(Descriptor.rename(desc, oldname, newname)); AttributeInfo.renameClass(finfo.getAttributes(), oldname, newname);
/** * 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); } }
/** * Sets the type of the field. */ public void setType(CtClass clazz) { declaringClass.checkModify(); fieldInfo.setDescriptor(Descriptor.of(clazz)); }
/** * Sets the type of the field. */ public void setType(CtClass clazz) { declaringClass.checkModify(); fieldInfo.setDescriptor(Descriptor.of(clazz)); }
/** * Sets the type of the field. */ public void setType(CtClass clazz) { declaringClass.checkModify(); fieldInfo.setDescriptor(Descriptor.of(clazz)); }
/** * Sets the type of the field. */ public void setType(CtClass clazz) { declaringClass.checkModify(); fieldInfo.setDescriptor(Descriptor.of(clazz)); }
/** * Sets the type of the field. */ public void setType(CtClass clazz) { declaringClass.checkModify(); fieldInfo.setDescriptor(Descriptor.of(clazz)); }
FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, oldname, newname));
/** * 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 classnames) { String jvmNewThisName = (String)classnames.get(Descriptor .toJvmName(thisclassname)); if (jvmNewThisName != null) thisclassname = Descriptor.toJavaName(jvmNewThisName); constPool.renameClass(classnames); ArrayList list = methods; int n = list.size(); for (int i = 0; i < n; ++i) { MethodInfo minfo = (MethodInfo)list.get(i); String desc = minfo.getDescriptor(); minfo.setDescriptor(Descriptor.rename(desc, classnames)); } list = fields; n = list.size(); for (int i = 0; i < n; ++i) { FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, classnames)); } }
FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, oldname, newname)); AttributeInfo.renameClass(finfo.getAttributes(), oldname, newname);
FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, classnames)); AttributeInfo.renameClass(finfo.getAttributes(), classnames);
FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, classnames)); AttributeInfo.renameClass(finfo.getAttributes(), classnames);
FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, oldname, newname)); AttributeInfo.renameClass(finfo.getAttributes(), oldname, newname);
FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, oldname, newname)); AttributeInfo.renameClass(finfo.getAttributes(), oldname, newname);
FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, classnames)); AttributeInfo.renameClass(finfo.getAttributes(), classnames);
FieldInfo finfo = (FieldInfo)list.get(i); String desc = finfo.getDescriptor(); finfo.setDescriptor(Descriptor.rename(desc, classnames)); AttributeInfo.renameClass(finfo.getAttributes(), classnames);