From: chiba Date: Tue, 6 Sep 2005 15:09:18 +0000 (+0000) Subject: updated javadoc comments X-Git-Tag: rel_3_17_1_ga~421 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d59bfd284a5a2f7dcb380ccb358621a5bd4b1b6b;p=javassist.git updated javadoc comments git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@204 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- diff --git a/src/main/javassist/CtBehavior.java b/src/main/javassist/CtBehavior.java index a8baaf8c..6069f5fd 100644 --- a/src/main/javassist/CtBehavior.java +++ b/src/main/javassist/CtBehavior.java @@ -51,7 +51,23 @@ public abstract class CtBehavior extends CtMember { } /** - * Undocumented method. Do not use; internal-use only. + * Returns the MethodInfo representing the method/constructor in the + * class file (read only). + * Normal applications do not need calling this method. Use + * getMethodInfo(). + * + *

The MethodInfo object obtained by this method + * is read only. Changes to this object might not be reflected + * on a class file generated by toBytecode(), + * toClass(), etc in CtClass. + * + *

This method is available even if the CtClass + * containing this method is frozen. However, if the class is + * frozen, the MethodInfo might be also pruned. + * + * @see #getMethodInfo() + * @see CtClass#isFrozen() + * @see CtClass#prune() */ public MethodInfo getMethodInfo2() { return methodInfo; } diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java index 1b3b588b..9e407962 100644 --- a/src/main/javassist/CtClass.java +++ b/src/main/javassist/CtClass.java @@ -51,7 +51,7 @@ public abstract class CtClass { /** * The version number of this release. */ - public static final String version = "3.1RC1"; + public static final String version = "3.1RC2"; /** * Prints the version number and the copyright notice. @@ -215,7 +215,22 @@ public abstract class CtClass { } /** - * Undocumented method. Do not use; internal-use only. + * Returns a class file for this class (read only). + * Normal applications do not need calling this method. Use + * getClassFile(). + * + *

The ClassFile object obtained by this method + * is read only. Changes to this object might not be reflected + * on a class file generated by toBytecode(), + * toClass(), etc. + * + *

This method is available even if isFrozen() + * is true. However, if the class is frozen, it might be also + * pruned. + * + * @see CtClass#getClassFile() + * @see CtClass#isFrozen() + * @see CtClass#prune() */ public ClassFile getClassFile2() { return null; } @@ -1029,8 +1044,8 @@ public abstract class CtClass { public void stopPruning(boolean stop) {} /** - * Discards unnecessary data, in particuar, CodeAttributes - * (method bodies) of the class, + * Discards unnecessary attributes, in particuar, + * CodeAttributes (method bodies) of the class, * to minimize the memory footprint. * After calling this method, the class is read only. * It cannot be modified any more. @@ -1040,9 +1055,14 @@ public abstract class CtClass { * However, the method names and signatures in the class etc. * are still accessible. * + *

toBytecode(), writeFile(), and + * toClass() internally call this method. + * * @see #toBytecode() * @see #toClass() * @see #writeFile() + * @see #instrument(CodeConverter) + * @see #instrument(ExprEditor) * * @see #stopPruning(boolean) */ diff --git a/src/main/javassist/CtField.java b/src/main/javassist/CtField.java index f4f2986a..fa446f4d 100644 --- a/src/main/javassist/CtField.java +++ b/src/main/javassist/CtField.java @@ -171,7 +171,23 @@ public class CtField extends CtMember { } /** - * Undocumented method. Do not use; internal-use only. + * Returns the FieldInfo representing the field in the class + * file (read only). + * Normal applications do not need calling this method. Use + * getFieldInfo(). + * + *

The FieldInfo object obtained by this method + * is read only. Changes to this object might not be reflected + * on a class file generated by toBytecode(), + * toClass(), etc in CtClass. + * + *

This method is available even if the CtClass + * containing this field is frozen. However, if the class is + * frozen, the FieldInfo might be also pruned. + * + * @see #getFieldInfo() + * @see CtClass#isFrozen() + * @see CtClass#prune() */ public FieldInfo getFieldInfo2() { return fieldInfo; } diff --git a/tutorial/tutorial.html b/tutorial/tutorial.html index 4670424e..29c56a68 100644 --- a/tutorial/tutorial.html +++ b/tutorial/tutorial.html @@ -114,21 +114,27 @@ Member methods in an interface can be created with abstractMethod() in CtNewMethod. Note that an interface method is an abstract method. - -

Frozen classes

+ +

Frozen classes

If a CtClass object is converted into a class file by writeFile(), toClass(), or toBytecode(), Javassist freezes that CtClass object. Further modifications of that CtClass object are -not permitted. +not permitted. This is for warning the developers when they attempt +to modify a class file that has been already loaded since the JVM does +not allow reloading a class.

When Javassist freezes a CtClass object, it also prunes the data structure contained in that object. To reduce memory -consumption, Javassist discards some part of data structure, for -example, the data of method bodies. Thus, after a +consumption, Javassist discards unnecessary attributes +(attribute_info structures) in that object. +For example, Code_attribute structures (method bodies) +are discarded. +Thus, after a CtClass object is pruned, the bytecode of a method is not -accessible although method names and signatures are accessible. +accessible although method names, signatures, and annotations +are still accessible.

To disallow pruning a CtClass, stopPruning() must be called in advance: @@ -283,7 +289,8 @@ program execution. This specification of ClassPool may cause huge memory consumption if the number of CtClass objects becomes amazingly large (this rarely happens since Javassist tries to reduce -memory consumption in various ways). To avoid this problem, you +memory consumption in various ways). +To avoid this problem, you can explicitly remove an unnecessary CtClass object from the ClassPool. If you call detach() on a CtClass object, then that CtClass object is