diff options
-rw-r--r-- | src/main/javassist/CtNewMethod.java | 7 | ||||
-rw-r--r-- | tutorial/tutorial.html | 4 | ||||
-rw-r--r-- | tutorial/tutorial3.html | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/main/javassist/CtNewMethod.java b/src/main/javassist/CtNewMethod.java index eb65b73e..0a929d63 100644 --- a/src/main/javassist/CtNewMethod.java +++ b/src/main/javassist/CtNewMethod.java @@ -244,8 +244,9 @@ public class CtNewMethod { * Creates a public setter method. The setter method assigns the * value of the first parameter to the specified field * in the class to which this method is added. - * The created method is initially not static even if the field is - * static. Change the modifiers if the method should be static. + * The created method is not static even if the field is + * static. You may not change it to be static + * by <code>setModifiers()</code> in <code>CtBehavior</code>. * * @param methodName the name of the setter * @param field the field accessed. @@ -269,7 +270,7 @@ public class CtNewMethod { code.addPutfield(Bytecode.THIS, fieldName, fieldType); } else { - code.addLoad(0, field.getType()); + code.addLoad(1, field.getType()); code.addPutstatic(Bytecode.THIS, fieldName, fieldType); } diff --git a/tutorial/tutorial.html b/tutorial/tutorial.html index 6c260011..6c9df81d 100644 --- a/tutorial/tutorial.html +++ b/tutorial/tutorial.html @@ -61,7 +61,7 @@ mapping between classes and <code>CtClass</code> objects. Javassist never allows two distinct <code>CtClass</code> objects to represent the same class unless two independent <code>ClassPool</code> are created. This is a significant feature for consistent program -transformaiton. To create multiple +transformation. To create multiple instances of <code>ClassPool</code>, write the following code: <ul><pre> @@ -119,7 +119,7 @@ pool.insertClassPath(new ClassClassPath(this.getClass())); <p> This statement registers the class path that was used for loading -the class of the object that <code>this</code> referes to. +the class of the object that <code>this</code> refers to. You can use any <code>Class</code> object as an argument instead of <code>this.getClass()</code>. The class path used for loading the class represented by that <code>Class</code> object is registered. diff --git a/tutorial/tutorial3.html b/tutorial/tutorial3.html index 89c68ae7..4b732978 100644 --- a/tutorial/tutorial3.html +++ b/tutorial/tutorial3.html @@ -46,7 +46,7 @@ in <code>CtClass</code> should be called. For example, <ul><pre> -FileInputStream fin +BufferedInputStream fin = new BufferedInputStream(new FileInputStream("Point.class")); ClassFile cf = new ClassFile(new DataInputStream(fin)); </pre></ul> |