aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2005-06-20 17:08:10 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2005-06-20 17:08:10 +0000
commit5de7634f05f343ff9573e140ea78a224d4ae3aa4 (patch)
treeccde1f6b837f01480830abe4ec7cd659dfea1768
parent1ae8f41102ad35c0ddc5a4ab73d0a38434e0d6c8 (diff)
downloadjavassist-5de7634f05f343ff9573e140ea78a224d4ae3aa4.tar.gz
javassist-5de7634f05f343ff9573e140ea78a224d4ae3aa4.zip
update the tutorial
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@183 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
-rw-r--r--src/main/javassist/bytecode/annotation/package.html2
-rw-r--r--tutorial/tutorial.html4
-rw-r--r--tutorial/tutorial3.html18
3 files changed, 18 insertions, 6 deletions
diff --git a/src/main/javassist/bytecode/annotation/package.html b/src/main/javassist/bytecode/annotation/package.html
index 4be4ae9f..6cf7e538 100644
--- a/src/main/javassist/bytecode/annotation/package.html
+++ b/src/main/javassist/bytecode/annotation/package.html
@@ -1,6 +1,6 @@
<html>
<body>
-Annotations.
+Annotations API.
<p>This package provides low-level API for editing annotations attributes.
diff --git a/tutorial/tutorial.html b/tutorial/tutorial.html
index 4cbf6821..709d2148 100644
--- a/tutorial/tutorial.html
+++ b/tutorial/tutorial.html
@@ -130,8 +130,6 @@ example, the data of method bodies. Thus, after a
<code>CtClass</code> object is pruned, the bytecode of a method is not
accessible although method names and signatures are accessible.
-<p>(Note: the current version of Javassist turns pruning off by default.)
-
<p>To disallow pruning a <code>CtClass</code>, <code>stopPruning()</code>
must be called in advance:
@@ -155,6 +153,8 @@ cc.defrost();
cc.setSuperclass(...); // OK since the class is not frozen.
</pre></ul>
+<p>To disallow pruning for all the <code>CtClass</code>es, set
+<code>ClassPool.doPruning</code> to <code>false</code>.
<h4>Class search path</h4>
diff --git a/tutorial/tutorial3.html b/tutorial/tutorial3.html
index f19e5c0d..657e629b 100644
--- a/tutorial/tutorial3.html
+++ b/tutorial/tutorial3.html
@@ -124,10 +124,10 @@ The following methods are part of the methods declared in
Move to the first instruction.<br>
<li><code>void move(int index)</code><br>
Move to the instruction specified by the given index.<br>
-<li><code>hasNext()</code><br>
+<li><code>boolean hasNext()</code><br>
Returns true if there is more instructions.<br>
-<li><code>next()</code><br>
-Returns the index of the next instruction.
+<li><code>int next()</code><br>
+Returns the index of the next instruction.<br>
<em>Note that it does not return the opcode of the next
instruction.</em><br>
<li><code>int byteAt(int index)</code><br>
@@ -141,6 +141,18 @@ Inserts a byte array at the index.
Branch offsets etc. are automatically adjusted.<br>
</ul>
+<p>The following code snippet displays all the instructions included
+in a method body:
+
+<ul><pre>
+CodeIterator ci = ... ;
+while (ci.hasNext()) {
+ int index = ci.next();
+ int op = ci.byteAt(index);
+ System.out.println(Mnemonic.OPCODE[op]);
+}
+</pre></ul>
+
<p><br>
<a name="bytecode">