summaryrefslogtreecommitdiffstats
path: root/tutorial/tutorial.html
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2011-06-21 11:27:56 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2011-06-21 11:27:56 +0000
commit41bb82351ccedc78bcff9271453edb8e42c8a66d (patch)
tree43a64847b9412b565e5bcd2e8a6deeab250c0ba9 /tutorial/tutorial.html
parent749d7725ab7cf8a4133b20f35f0ab62930d70aa5 (diff)
downloadjavassist-41bb82351ccedc78bcff9271453edb8e42c8a66d.tar.gz
javassist-41bb82351ccedc78bcff9271453edb8e42c8a66d.zip
a minor bug fix
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@582 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'tutorial/tutorial.html')
-rw-r--r--tutorial/tutorial.html4
1 files changed, 3 insertions, 1 deletions
diff --git a/tutorial/tutorial.html b/tutorial/tutorial.html
index d62743d0..dea83069 100644
--- a/tutorial/tutorial.html
+++ b/tutorial/tutorial.html
@@ -1044,7 +1044,9 @@ adds a new field <code>hiddenValue</code> to <code>java.lang.String</code>:
<ul><pre>ClassPool pool = ClassPool.getDefault();
CtClass cc = pool.get("java.lang.String");
-cc.addField(new CtField(CtClass.intType, "hiddenValue", cc));
+CtField f = new CtField(CtClass.intType, "hiddenValue", cc);
+f.setModifiers(Modifier.PUBLIC);
+cc.addField(f);
cc.writeFile(".");</pre></ul>
<p>This program produces a file <code>"./java/lang/String.class"</code>.