Luis Sigal | 69e1761 | 2011-02-24 17:22:41 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <HEAD> |
| 3 | <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> |
| 4 | <TITLE>Read Me First</TITLE> |
| 5 | </HEAD> |
| 6 | <body> |
| 7 | |
| 8 | <h1>Javassist version 3</h1> |
| 9 | |
| 10 | <h3>Copyright (C) 1999-2010 by Shigeru Chiba, All rights reserved.</h3> |
| 11 | |
| 12 | <p><br></p> |
| 13 | |
| 14 | <p>Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation |
| 15 | simple. It is a class library for editing bytecodes in Java; |
| 16 | it enables Java programs to define a new class at runtime and to |
| 17 | modify a class file when the JVM loads it. Unlike other similar |
| 18 | bytecode editors, Javassist provides two levels of API: source level |
| 19 | and bytecode level. If the users use the source-level API, they can |
| 20 | edit a class file without knowledge of the specifications of the Java |
| 21 | bytecode. The whole API is designed with only the vocabulary of the |
| 22 | Java language. You can even specify inserted bytecode in the form of |
| 23 | source text; Javassist compiles it on the fly. On the other hand, the |
| 24 | bytecode-level API allows the users to directly edit a class file as |
| 25 | other editors. |
| 26 | |
| 27 | <p><br> |
| 28 | |
| 29 | <h2>Files</h2> |
| 30 | |
| 31 | <ul> |
| 32 | <table> |
| 33 | <tr> |
| 34 | <td><li><tt><a href="License.html">License.html</a></tt></td> |
| 35 | <td>License file |
| 36 | (Also see the <a href="#copyright">copyright notices</a> below)</td> |
| 37 | </tr> |
| 38 | |
| 39 | <tr> |
| 40 | <td><li><tt><a href="tutorial/tutorial.html">tutorial/tutorial.html</a></tt></td> |
| 41 | <td>Tutorial</td> |
| 42 | </tr> |
| 43 | |
| 44 | <tr> |
| 45 | <td><li><tt>./javassist.jar</tt></td> |
| 46 | <td>The Javassist jar file (class files)</td> |
| 47 | </tr> |
| 48 | |
| 49 | <tr> |
| 50 | <td><li><tt>./src/main</tt></td> |
| 51 | <td>The source files</td> |
| 52 | </tr> |
| 53 | |
| 54 | <tr> |
| 55 | <td><li><tt><a href="html/index.html">html/index.html</a></tt></td> |
| 56 | <td>The top page of the Javassist API document.</td> |
| 57 | </tr> |
| 58 | |
| 59 | <tr> |
| 60 | <td><li><tt>./sample/</tt></td> |
| 61 | <td>Sample programs</td> |
| 62 | </tr> |
| 63 | </table> |
| 64 | </ul> |
| 65 | |
| 66 | <p><br> |
| 67 | |
| 68 | <h2>How to run sample programs</h2> |
| 69 | |
| 70 | <p>JDK 1.4 or later is needed. |
| 71 | |
| 72 | <h3>0. If you have Apache Ant</h3> |
| 73 | |
| 74 | <p>Run the sample-all task. |
| 75 | Otherwise, follow the instructions below. |
| 76 | |
| 77 | <h3>1. Move to the directory where this Readme.html file is located.</h3> |
| 78 | |
| 79 | <p>In the following instructions, we assume that the javassist.jar |
| 80 | file is included in the class path. |
| 81 | For example, the javac and java commands must receive |
| 82 | the following <code>classpath</code> option: |
| 83 | |
| 84 | <ul><pre> |
| 85 | -classpath ".:javassist.jar" |
| 86 | </pre></ul> |
| 87 | |
| 88 | <p>If the operating system is Windows, the path |
| 89 | separator must be not <code>:</code> (colon) but |
| 90 | <code>;</code> (semicolon). The java command can receive |
| 91 | the <code>-cp</code> option |
| 92 | as well as <code>-classpath</code>. |
| 93 | |
| 94 | <p>If you don't want to use the class-path option, you can make |
| 95 | <code>javassist.jar</code> included in the <code>CLASSPATH</code> |
| 96 | environment: |
| 97 | |
| 98 | <ul><pre> |
| 99 | export CLASSPATH=.:javassist.jar |
| 100 | </pre></ul> |
| 101 | |
| 102 | <p>or if the operating system is Windows: |
| 103 | |
| 104 | <ul><pre> |
| 105 | set CLASSPATH=.;javassist.jar |
| 106 | </pre></ul> |
| 107 | |
| 108 | |
| 109 | <p>Otherwise, you can copy <tt>javassist.jar</tt> to the directory |
| 110 | |
| 111 | <ul><<i>java-home</i>><tt>/jre/lib/ext</tt>.</ul> |
| 112 | |
| 113 | <p><<i>java-home</i>> depends on the system. It is usually |
| 114 | <tt>/usr/local/java</tt>, <tt>c:\j2sdk1.4\</tt>, etc. |
| 115 | |
| 116 | <h3>2. sample/Test.java</h3> |
| 117 | |
| 118 | <p> This is a very simple program using Javassist. |
| 119 | |
| 120 | <p> To run, type the commands: |
| 121 | |
| 122 | <ul><pre> |
| 123 | % javac sample/Test.java |
| 124 | % java sample.Test |
| 125 | </pre></ul> |
| 126 | |
| 127 | <p> For more details, see <a type="text/plain" href="sample/Test.java">sample/Test.java</a> |
| 128 | |
| 129 | <h3>3. sample/reflect/*.java</h3> |
| 130 | |
| 131 | <p> This is the "verbose metaobject" example well known in reflective |
| 132 | programming. This program dynamically attaches a metaobject to |
| 133 | a Person object. The metaobject prints a message if a method |
| 134 | is called on the Person object. |
| 135 | |
| 136 | <p> To run, type the commands: |
| 137 | |
| 138 | <ul><pre> |
| 139 | % javac sample/reflect/*.java |
| 140 | % java javassist.tools.reflect.Loader sample.reflect.Main Joe |
| 141 | </pre></ul> |
| 142 | |
| 143 | <p>Compare this result with that of the regular execution without reflection: |
| 144 | |
| 145 | <ul><pre>% java sample.reflect.Person Joe</pre></ul> |
| 146 | |
| 147 | <p> For more details, see <a type="text/plain" href="sample/reflect/Main.java">sample/reflect/Main.java</a> |
| 148 | |
| 149 | <p> Furthermore, the Person class can be statically modified so that |
| 150 | all the Person objects become reflective without sample.reflect.Main. |
| 151 | To do this, type the commands: |
| 152 | |
| 153 | <ul><pre> |
| 154 | % java javassist.tools.reflect.Compiler sample.reflect.Person -m sample.reflect.VerboseMetaobj |
| 155 | </pre></ul> |
| 156 | |
| 157 | <p> Then, |
| 158 | <ul><pre> |
| 159 | % java sample.reflect.Person Joe |
| 160 | </pre></ul> |
| 161 | |
| 162 | <h3>4. sample/duplicate/*.java</h3> |
| 163 | |
| 164 | <p> This is another example of reflective programming. |
| 165 | |
| 166 | <p> To run, type the commands: |
| 167 | |
| 168 | <ul><pre> |
| 169 | % javac sample/duplicate/*.java |
| 170 | % java sample.duplicate.Main |
| 171 | </pre></ul> |
| 172 | |
| 173 | <p>Compare this result with that of the regular execution without reflection: |
| 174 | |
| 175 | <ul><pre>% java sample.duplicate.Viewer</pre></ul> |
| 176 | |
| 177 | <p>For more details, see |
| 178 | <a type="text/plain" href="sample/duplicate/Main.java">sample/duplicate/Main.java</a> |
| 179 | |
| 180 | <h3>5. sample/vector/*.java</h3> |
| 181 | |
| 182 | <p>This example shows the use of Javassit for producing a class representing |
| 183 | a vector of a given type at compile time. |
| 184 | |
| 185 | <p> To run, type the commands: |
| 186 | <ul><pre> |
| 187 | % javac sample/vector/*.java |
| 188 | % java sample.preproc.Compiler sample/vector/Test.j |
| 189 | % javac sample/vector/Test.java |
| 190 | % java sample.vector.Test |
| 191 | </pre></ul> |
| 192 | |
| 193 | <p>Note: <code>javassist.jar</code> is unnecessary to compile and execute |
| 194 | <code>sample/vector/Test.java</code>. |
| 195 | |
| 196 | For more details, see |
| 197 | <a type="text/plain" href="sample/vector/Test.j">sample/vector/Test.j</a> |
| 198 | and <a type="text/plain" href="sample/vector/VectorAssistant.java">sample/vector/VectorAssistant.java</a> |
| 199 | |
| 200 | <h3>6. sample/rmi/*.java</h3> |
| 201 | |
| 202 | <p> This demonstrates the javassist.rmi package. |
| 203 | |
| 204 | <p> To run, type the commands: |
| 205 | <ul><pre> |
| 206 | % javac sample/rmi/*.java |
| 207 | % java sample.rmi.Counter 5001 |
| 208 | </pre></ul> |
| 209 | |
| 210 | <p> The second line starts a web server listening to port 5001. |
| 211 | |
| 212 | <p> Then, open <a href="sample/rmi/webdemo.html">sample/rmi/webdemo.html</a> |
| 213 | with a web browser running |
| 214 | on the local host. (<tt>webdemo.html</tt> trys to fetch an applet from |
| 215 | <tt>http://localhost:5001/</tt>, which is the web server we started above.) |
| 216 | |
| 217 | <p> Otherwise, run sample.rmi.CountApplet as an application: |
| 218 | |
| 219 | <ul><pre> |
| 220 | % java javassist.web.Viewer localhost 5001 sample.rmi.CountApplet |
| 221 | </pre></ul> |
| 222 | |
| 223 | <h3>7. sample/evolve/*.java</h3> |
| 224 | |
| 225 | <p> This is a demonstration of the class evolution mechanism implemented |
| 226 | with Javassist. This mechanism enables a Java program to reload an |
| 227 | existing class file under some restriction. |
| 228 | |
| 229 | <p> To run, type the commands: |
| 230 | <ul><pre> |
| 231 | % javac sample/evolve/*.java |
| 232 | % java sample.evolve.DemoLoader 5003 |
| 233 | </pre></ul> |
| 234 | |
| 235 | <p> The second line starts a class loader DemoLoader, which runs a web |
| 236 | server DemoServer listening to port 5003. |
| 237 | |
| 238 | <p> Then, open <a href="http://localhost:5003/demo.html">http://localhost:5003/demo.html</a> with a web browser running |
| 239 | on the local host. |
| 240 | (Or, see <a href="sample/evolve/start.html">sample/evolve/start.html</a>.) |
| 241 | |
| 242 | <h3>8. sample/hotswap/*.java</h3> |
| 243 | |
| 244 | <p>This shows dynamic class reloading by the JPDA. It needs JDK 1.4 or later. |
| 245 | To run, first type the following commands: |
| 246 | |
| 247 | <ul><pre> |
| 248 | % cd sample/hotswap |
| 249 | % javac *.java |
| 250 | % cd logging |
| 251 | % javac *.java |
| 252 | % cd .. |
| 253 | </pre></ul> |
| 254 | |
| 255 | <p>If your Java is 1.4, then type: |
| 256 | |
| 257 | <ul><pre> |
| 258 | % java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 Test |
| 259 | </pre></ul> |
| 260 | |
| 261 | <p>If you are using Java 5, then type: |
| 262 | |
| 263 | <ul><pre> |
| 264 | % java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 Test |
| 265 | </pre></ul> |
| 266 | |
| 267 | <p>Note that the class path must include <code>JAVA_HOME/lib/tools.jar</code>. |
| 268 | |
| 269 | <h2>Hints</h2> |
| 270 | |
| 271 | <p>To know the version number, type this command: |
| 272 | |
| 273 | <ul><pre> |
| 274 | % java -jar javassist.jar |
| 275 | </pre></ul> |
| 276 | |
| 277 | <p>Javassist provides a class file viewer for debugging. For more details, |
| 278 | see javassist.Dump. |
| 279 | |
| 280 | <p><br> |
| 281 | |
| 282 | <h2>Changes</h2> |
| 283 | |
| 284 | <p>-version 3.14 on October 5, 2010 |
| 285 | |
| 286 | <ul> |
| 287 | <li>JIRA JASSIST-121, 123, 128, 129, 130, 131, 132. |
| 288 | </ul> |
| 289 | |
| 290 | <p>-version 3.13 on July 19, 2010 |
| 291 | |
| 292 | <ul> |
| 293 | <li>JIRA JASSIST-118, 119, 122, 124, 125. |
| 294 | </ul> |
| 295 | |
| 296 | <p>-version 3.12.1 on June 10, 2010 |
| 297 | |
| 298 | <p>-version 3.12 on April 16, 2010 |
| 299 | |
| 300 | <p>-version 3.11 on July 3, 2009 |
| 301 | <ul> |
| 302 | <li>JIRA JASSIST-67, 68, 74, 75, 76, 77, 81, 83, 84, 85, 86, 87 were fixed. |
| 303 | <li>Now javassist.bytecode.CodeIterator can insert a gap into |
| 304 | a large method body more than 32KB. (JIRA JASSIST-79, 80) |
| 305 | </ul> |
| 306 | |
| 307 | <p>-version 3.10 on March 5, 2009 |
| 308 | |
| 309 | <ul> |
| 310 | <li>JIRA JASSIST-69, 70, 71 were fixed. |
| 311 | </ul> |
| 312 | |
| 313 | <p>-version 3.9 on October 9, 2008 |
| 314 | <ul> |
| 315 | <li>ClassPool.makeClassIfNew(InputStream) was implemented. |
| 316 | <li>CtNewMethod.wrapped(..) and CtNewConstructor.wrapped(..) |
| 317 | implicitly append a method like _added_m$0. |
| 318 | This method now has a synthetic attribute. |
| 319 | <li>JIRA JASSIST-66 has been fixed. |
| 320 | </ul> |
| 321 | |
| 322 | <p>-version 3.8.1 on July 17, 2008 |
| 323 | <ul> |
| 324 | <li>CtClass.rebuildClassFile() has been added. |
| 325 | <li>A few bugs of javassist.bytecode.analysis have been fixed. |
| 326 | 3.8.0 could not correctly deal with one letter class name |
| 327 | such as I and J. |
| 328 | </ul> |
| 329 | |
| 330 | <p>-version 3.8.0 on June 13, 2008 |
| 331 | <ul> |
| 332 | <li>javassist.bytecode.analysis was implemented. |
| 333 | <li>JASSIST-45, 47, 51, 54-57, 60, 62 were fixed. |
| 334 | </ul> |
| 335 | |
| 336 | <p>-version 3.7.1 on March 10, 2008 |
| 337 | <ul> |
| 338 | <li>a bug of javassist.util.proxy has been fixed. |
| 339 | </ul> |
| 340 | |
| 341 | <p>-version 3.7 on January 20, 2008 |
| 342 | <ul> |
| 343 | <li>Several minor bugs have been fixed. |
| 344 | </ul> |
| 345 | |
| 346 | <p>-version 3.6.0 on September 13, 2007 |
| 347 | |
| 348 | <p>-version 3.6.0.CR1 on July 27, 2007 |
| 349 | |
| 350 | <ul> |
| 351 | <li>The stack map table introduced since Java 6 has been supported. |
| 352 | <li>CtClass#getDeclaredBehaviors() now returns a class initializer |
| 353 | as well as methods and constructors. |
| 354 | <li>The default status of automatic pruning was made off. |
| 355 | Instead of pruning, this version of Javassist compresses |
| 356 | the data structure of a class file after toBytecode() is called. |
| 357 | The compressed class file is automatically decompressed when needed. |
| 358 | This saves memory space better than pruning. |
| 359 | <li><a href="http://jira.jboss.com/jira/browse/JASSIST-33">JIRA JASSIST-33</a> has been fixed. |
| 360 | </ul> |
| 361 | |
| 362 | <p>-version 3.5 on April 29, 2007 |
| 363 | <ul> |
| 364 | <li>Various minor updates. |
| 365 | </ul> |
| 366 | |
| 367 | <p>-version 3.4 on November 17, 2006 |
| 368 | <ul> |
| 369 | <li>A bug in CodeConverter#replaceFieldRead() and CodeConverter#replaceFieldWrite() |
| 370 | was fixed. <a href="http://jira.jboss.com/jira/browse/JBAOP-284">JBAOP-284</a>. |
| 371 | |
| 372 | <li>A synchronization bug and a performance bug in <code>javassist.util.proxy</code> |
| 373 | have been fixed |
| 374 | (<a href="http://jira.jboss.com/jira/browse/JASSIST-28">JASSIST-28</a>). |
| 375 | Now generated proxy classes are cached. To turn the caching off, |
| 376 | set <code>ProxyFactory.useCache</code> to <code>false</code>. |
| 377 | </ul> |
| 378 | |
| 379 | <p>-version 3.3 on August 17, 2006 |
| 380 | <ul> |
| 381 | <li>CtClass#toClass() and ClassPool#toClass() were modified to accept a |
| 382 | <code>ProtectionDomain</code> |
| 383 | (<a href="http://jira.jboss.com/jira/browse/JASSIST-23">JASSIST-23</a>). |
| 384 | Now ClassPool#toClass(CtClass, ClassLoader) should not be overridden. All |
| 385 | subclasses of ClassPool must override toClass(CtClass, ClassLoader, |
| 386 | ProtectionDomain). |
| 387 | |
| 388 | <li>CtClass#getAvailableAnnotations() etc. have been implemented. |
| 389 | |
| 390 | <li>A bug related to a way of dealing with a bridge method was fixed |
| 391 | (<a href="http://jira.jboss.com/jira/browse/HIBERNATE-37">HIBERNATE-37</a>). |
| 392 | |
| 393 | <li>javassist.scopedpool package was added. |
| 394 | </ul> |
| 395 | |
| 396 | <p>-version 3.2 on June 21, 2006 |
| 397 | |
| 398 | <ul> |
| 399 | <li>The behavior of CtBehavior#getParameterAnnotations() has been changed. |
| 400 | It is now compatible to Java Reflection API |
| 401 | (<a href="http://jira.jboss.com/jira/browse/JASSIST-19">JASSIST-19</a>). |
| 402 | </ul> |
| 403 | |
| 404 | <p>- version 3.2.0.CR2 on May 9, 2006 |
| 405 | <ul> |
| 406 | <li>A bug of replace(String,ExprEditor) in javassist.expr.Expr has been fixed. |
| 407 | <li>Updated ProxyFactory getClassLoader to choose the javassit class loader |
| 408 | when the proxy superclass has a null class loader (a jdk/endorsed class) |
| 409 | (<a href='http://jira.jboss.com/jira/browse/JASSIST-18'>JASSIST-18</a>). |
| 410 | <li>Updated the throws clause of the javassist.util.proxy.MethodHandler |
| 411 | to be Throwable rather than Exception |
| 412 | (<a href='http://jira.jboss.com/jira/browse/JASSIST-16'>JASSIST-16</a>). |
| 413 | </ul> |
| 414 | |
| 415 | <p>- version 3.2.0.CR1 on March 18, 2006 |
| 416 | <ul> |
| 417 | <li>Annotations enhancements to javassist.bytecode.MethodInfo. |
| 418 | <li>Allow a ClassPool to override the "guess" at the classloader to use. |
| 419 | </ul> |
| 420 | |
| 421 | <p>- version 3.1 on February 23, 2006 |
| 422 | |
| 423 | <ul> |
| 424 | <li>getFields(), getMethods(), and getConstructors() in CtClass |
| 425 | were changed to return non-private memebers instead of only |
| 426 | public members. |
| 427 | <li>getEnclosingClass() in javassist.CtClass was renamed |
| 428 | to getEnclosingMethod(). |
| 429 | <li>getModifiers() was extended to return Modifier.STATIC if the class |
| 430 | is a static inner class. |
| 431 | <li>The return type of CtClass.stopPruning() was changed from void |
| 432 | to boolean. |
| 433 | <li>toMethod() in javassist.CtConstructor has been implemented. |
| 434 | <li>It includes new javassist.util.proxy package |
| 435 | similar to Enhancer of CGLIB. |
| 436 | <p> |
| 437 | <li>The subpackages of Javassist were restructured. |
| 438 | <ul> |
| 439 | <li>javassist.tool package was renamed to javassist.tools. |
| 440 | <li>HotSwapper was moved to javassist.util. |
| 441 | <li>Several subpackages were moved to javassist.tools. |
| 442 | <li>javassist.preproc package was elminated and the source was |
| 443 | moved to the sample directory. |
| 444 | </ul> |
| 445 | </ul> |
| 446 | |
| 447 | <p>- version 3.1 RC2 on September 7, 2005 |
| 448 | |
| 449 | <ul> |
| 450 | <li>RC2 is released mainly for an administrative reason. |
| 451 | <li>A few bugs have been fixed. |
| 452 | </ul> |
| 453 | |
| 454 | <p>- version 3.1 RC1 on August 29, 2005 |
| 455 | |
| 456 | <ul> |
| 457 | <li>Better annotation supports. See <code>CtClass.getAnnotations()</code> |
| 458 | <li>javassist.tool.HotSwapper was added. |
| 459 | <li>javassist.ClassPool.importPackage() was added. |
| 460 | <li>The compiler now accepts array initializers |
| 461 | (only one dimensional arrays). |
| 462 | <li>javassist.Dump was moved to javassist.tool.Dump. |
| 463 | <li>Many bugs were fixed. |
| 464 | </ul> |
| 465 | |
| 466 | <p>- version 3.0 on January 18, 2005 |
| 467 | |
| 468 | <ul> |
| 469 | <li>The compiler now supports synchronized statements and finally |
| 470 | clauses. |
| 471 | <li>You can now remove a method and a field. |
| 472 | </ul> |
| 473 | |
| 474 | <p>- version 3.0 RC1 on September 13, 2004. |
| 475 | |
| 476 | <ul> |
| 477 | <li>CtClass.toClass() has been reimplemented. The behavior has been |
| 478 | changed. |
| 479 | <li>javassist.expr.NewArray has been implemented. It enables modifying |
| 480 | an expression for array creation. |
| 481 | <li><code>.class</code> notation has been supported. The modified class |
| 482 | file needs javassist.runtime.DotClass at runtime. |
| 483 | <li>a bug in <code>CtClass.getMethods()</code> has been fixed. |
| 484 | <li>The compiler supports a switch statement. |
| 485 | </ul> |
| 486 | |
| 487 | <p>- version 3.0 beta on May 18th, 2004. |
| 488 | |
| 489 | <ul> |
| 490 | <li>The ClassPool framework has been redesigned. |
| 491 | <ul> |
| 492 | <li>writeFile(), write(), ... in ClassPool have been moved to CtClass. |
| 493 | <li>The design of javassist.Translator has been changed. |
| 494 | </ul> |
| 495 | |
| 496 | <li>javassist.bytecode.annotation has been added for meta tags. |
| 497 | <li>CtClass.makeNestedClass() has been added. |
| 498 | <li>The methods declared in javassist.bytecode.InnerClassesAttribute |
| 499 | have been renamed a bit. |
| 500 | <li>Now local variables were made available in the source text passed to |
| 501 | CtBehavior.insertBefore(), MethodCall.replace(), etc. |
| 502 | <li>CtClass.main(), which prints the version number, has been added. |
| 503 | <li>ClassPool.SimpleLoader has been public. |
| 504 | <li>javassist.bytecode.DeprecatedAttribute has been added. |
| 505 | <li>javassist.bytecode.LocalVariableAttribute has been added. |
| 506 | <li>CtClass.getURL() and javassist.ClassPath.find() has been added. |
| 507 | <li>CtBehavior.insertAt() has been added. |
| 508 | <li>CtClass.detach() has been added. |
| 509 | <li>CodeAttribute.computeMaxStack() has been added. |
| 510 | </ul> |
| 511 | |
| 512 | <p>- version 2.6 in August, 2003. |
| 513 | |
| 514 | <ul> |
| 515 | <li>The behavior of CtClass.setSuperclass() was changed. |
| 516 | To obtain the previous behavior, call CtClass.replaceClassName(). |
| 517 | <li>CtConstructor.setBody() now works for class initializers. |
| 518 | <li>CtNewMethod.delegator() now works for static methods. |
| 519 | <li>javassist.expr.Expr.indexOfBytecode() has been added. |
| 520 | <li>javassist.Loader has been modified so that getPackage() returns |
| 521 | a package object. |
| 522 | <li>Now, the compiler can correctly compile a try statement and an |
| 523 | infinite while-loop. |
| 524 | </ul> |
| 525 | |
| 526 | <p>- version 2.5.1 in May, 2003. |
| 527 | <br>Simple changes for integration with JBoss AOP |
| 528 | <ul> |
| 529 | <li>Made ClassPool.get0 protected so that subclasses of ClassPool can call it. |
| 530 | <li>Moved all access to the class cache (the field ClassPool.classes) to a method called getCached(String classname). This is so subclasses of ClassPool can override this behavior. |
| 531 | </ul> |
| 532 | |
| 533 | <p>- version 2.5 in May, 2003. |
| 534 | <br>From this version, Javassist is part of the JBoss project. |
| 535 | <ul> |
| 536 | <li>The license was changed from MPL to MPL/LGPL dual. |
| 537 | <li>ClassPool.removeClassPath() and ClassPath.close() have been added. |
| 538 | <li>ClassPool.makeClass(InputStream) has been added. |
| 539 | <li>CtClass.makeClassInitializer() has been added. |
| 540 | <li>javassist.expr.Expr has been changed to a public class. |
| 541 | <li>javassist.expr.Handler has been added. |
| 542 | <li>javassist.expr.MethodCall.isSuper() has been added. |
| 543 | <li>CtMethod.isEmpty() and CtConstructor.isEmpty() have been added. |
| 544 | <li>LoaderClassPath has been implemented. |
| 545 | </ul> |
| 546 | |
| 547 | <p>- version 2.4 in February, 2003. |
| 548 | <ul> |
| 549 | <li>The compiler included in Javassist did not correctly work with |
| 550 | interface methods. This bug was fixed. |
| 551 | <li>Now javassist.bytecode.Bytecode allows more than 255 local |
| 552 | variables in the same method. |
| 553 | <li>javassist.expr.Instanceof and Cast have been added. |
| 554 | <li>javassist.expr.{MethodCall,NewExpr,FieldAccess,Instanceof,Cast}.where() |
| 555 | have been added. They return the caller-side method surrounding the |
| 556 | expression. |
| 557 | <li>javassist.expr.{MethodCall,NewExpr,FieldAccess,Instanceof,Cast}.mayThrow() |
| 558 | have been added. |
| 559 | <li>$class has been introduced. |
| 560 | <li>The parameters to replaceFieldRead(), replaceFieldWrite(), |
| 561 | and redirectFieldAccess() in javassist.CodeConverter are changed. |
| 562 | <li>The compiler could not correctly handle a try-catch statement. |
| 563 | This bug has been fixed. |
| 564 | </ul> |
| 565 | |
| 566 | <p>- version 2.3 in December, 2002. |
| 567 | <ul> |
| 568 | <li>The tutorial has been revised a bit. |
| 569 | <li>SerialVersionUID class was donated by Bob Lee. Thanks. |
| 570 | <li>CtMethod.setBody() and CtConstructor.setBody() have been added. |
| 571 | <li>javassist.reflect.ClassMetaobject.useContextClassLoader has been added. |
| 572 | If true, the reflection package does not use Class.forName() but uses |
| 573 | a context class loader specified by the user. |
| 574 | <li>$sig and $type are now available. |
| 575 | <li>Bugs in Bytecode.write() and read() have been fixed. |
| 576 | </ul> |
| 577 | |
| 578 | <p>- version 2.2 in October, 2002. |
| 579 | <ul> |
| 580 | <li>The tutorial has been revised. |
| 581 | <li>A new package <code>javassist.expr</code> has been added. |
| 582 | This is replacement of classic <code>CodeConverter</code>. |
| 583 | <li>javassist.ConstParameter was changed into |
| 584 | javassist.CtMethod.ConstParameter. |
| 585 | <li>javassist.FieldInitializer was renamed into |
| 586 | javassist.CtField.Initializer. |
| 587 | <li>A bug in javassist.bytecode.Bytecode.addInvokeinterface() has been |
| 588 | fixed. |
| 589 | <li>In javassist.bytecode.Bytecode, addGetfield(), addGetstatic(), |
| 590 | addInvokespecial(), addInvokestatic(), addInvokevirtual(), |
| 591 | and addInvokeinterface() |
| 592 | have been modified to update the current statck depth. |
| 593 | </ul> |
| 594 | |
| 595 | <p>- version 2.1 in July, 2002. |
| 596 | <ul> |
| 597 | <li>javassist.CtMember and javassist.CtBehavior have been added. |
| 598 | <li>javassist.CtClass.toBytecode() has been added. |
| 599 | <li>javassist.CtClass.toClass() and javassist.ClassPool.writeAsClass() |
| 600 | has been added. |
| 601 | <li>javassist.ByteArrayClassPath has been added. |
| 602 | <li>javassist.bytecode.Mnemonic has been added. |
| 603 | <li>Several bugs have been fixed. |
| 604 | </ul> |
| 605 | |
| 606 | <p>- version 2.0 (major update) in November, 2001. |
| 607 | <ul> |
| 608 | <li>The javassist.bytecode package has been provided. It is a |
| 609 | lower-level API for directly modifying a class file although |
| 610 | the users must have detailed knowledge of the Java bytecode. |
| 611 | |
| 612 | <li>The mechanism for creating CtClass objects have been changed. |
| 613 | |
| 614 | <li>javassist.tool.Dump moves to the javassist package. |
| 615 | </ul> |
| 616 | |
| 617 | <p>version 1.0 in July, 2001. |
| 618 | <ul> |
| 619 | <li>javassist.reflect.Metaobject and ClassMetaobject was changed. |
| 620 | Now they throw the same exception that they receive from a |
| 621 | base-level object. |
| 622 | </ul> |
| 623 | |
| 624 | <p>- version 0.8 |
| 625 | <ul> |
| 626 | <li>javassist.tool.Dump was added. It is a class file viewer. |
| 627 | |
| 628 | <li>javassist.FiledInitializer.byNewArray() was added. It is for |
| 629 | initializing a field with an array object. |
| 630 | |
| 631 | <li>javassist.CodeConverter.redirectMethodCall() was added. |
| 632 | |
| 633 | <li>javassist.Run was added. |
| 634 | </ul> |
| 635 | |
| 636 | <p>- version 0.7 |
| 637 | <ul> |
| 638 | <li>javassit.Loader was largely modified. javassist.UserLoader was |
| 639 | deleted. Instead, Codebase was renamed to ClassPath |
| 640 | and UserClassPath was added. Now programmers who want to |
| 641 | customize Loader must write a class implementing UserClassPath |
| 642 | instead of UserLoader. This change is for sharing class search paths |
| 643 | between Loader and CtClass.CtClass(String). |
| 644 | |
| 645 | <li>CtClass.addField(), addMethod(), addConstructor(), addWrapper() were |
| 646 | also largely modified so that it receives CtNewMethod, CtNewConstructor, |
| 647 | or CtNewField. The static methods for creating these objects were |
| 648 | added to the API. |
| 649 | |
| 650 | <li>Constructors are now represented by CtConstructor objects. |
| 651 | CtConstructor is a subclass of CtMethod. |
| 652 | |
| 653 | <li>CtClass.getUserAttribute() was removed. Use CtClass.getAttribute(). |
| 654 | |
| 655 | <li>javassist.rmi.RmiLoader was added. |
| 656 | |
| 657 | <li>javassist.reflect.Metalevel._setMetaobject() was added. Now |
| 658 | metaobjects can be replaced at runtime. |
| 659 | </ul> |
| 660 | |
| 661 | <p>- version 0.6 |
| 662 | <ul> |
| 663 | <li>Javassist was modified to correctly deal with array types appearing |
| 664 | in signatures. |
| 665 | |
| 666 | <li>A bug crashed resulting bytecode if a class includes a private static |
| 667 | filed. It has been fixed. |
| 668 | |
| 669 | <li>javassist.CtNewInterface was added. |
| 670 | |
| 671 | <li>javassist.Loader.recordClass() was renamed into makeClass(). |
| 672 | |
| 673 | <li>javassist.UserLoader.loadClass() was changed to take the second |
| 674 | parameter. |
| 675 | </ul> |
| 676 | |
| 677 | <p>- version 0.5 |
| 678 | <ul> |
| 679 | <li>a bug-fix version. |
| 680 | </ul> |
| 681 | |
| 682 | <p>- version 0.4 |
| 683 | <ul> |
| 684 | <li>Major update again. Many classes and methods were changed. |
| 685 | Most of methods taking java.lang.Class have been changed to |
| 686 | take javassist.CtClass. |
| 687 | </ul> |
| 688 | |
| 689 | <p>- version 0.3 |
| 690 | <ul> |
| 691 | <li>Major update. Many classes and methods were changed. |
| 692 | </ul> |
| 693 | |
| 694 | <p>- version 0.2 |
| 695 | <ul> |
| 696 | <li>Jar/zip files are supported. |
| 697 | </ul> |
| 698 | |
| 699 | <p>-version 0.1 on April 16, 1999. |
| 700 | <ul> |
| 701 | <li>The first release. |
| 702 | </ul> |
| 703 | |
| 704 | <p><br> |
| 705 | |
| 706 | <h2>Bug reports etc.</h2> |
| 707 | |
| 708 | <dl> |
| 709 | <dt>Bug reports: |
| 710 | <dd>Post your reports at <a href="http://www.jboss.org/jive.jsp">Forums</a> |
| 711 | or directly send an email to: |
| 712 | <br> |
| 713 | <tt><a href="mailto:chiba@acm.org">chiba@acm.org</a></tt> |
| 714 | or |
| 715 | <tt><a href="mailto:chiba@is.titech.ac.jp">chiba@is.titech.ac.jp</a></tt> |
| 716 | <br> |
| 717 | |
| 718 | <p><dt>The home page of Javassist: |
| 719 | <dd>Visit <a href="http://www.javassist.org"><tt>www.javassist.org</tt></a> |
| 720 | and <a href="http://www.jboss.org/index.html?module=html&op=userdisplay&id=developers/projects/javassist"><tt>www.jboss.org</tt></a> |
| 721 | |
| 722 | </dl> |
| 723 | |
| 724 | <p><br> |
| 725 | |
| 726 | <a name="copyright"> |
| 727 | <h2>Copyright notices</h2> |
| 728 | |
| 729 | <p>Javassist, a Java-bytecode translator toolkit. |
| 730 | <br>Copyright (C) 1999-2010 Shigeru Chiba. All Rights Reserved. |
| 731 | |
| 732 | <p>The contents of this software, Javassist, are subject to |
| 733 | the Mozilla Public License Version 1.1 (the "License");<br> |
| 734 | you may not use this software except in compliance |
| 735 | with the License. You may obtain a copy of the License at |
| 736 | <br>http://www.mozilla.org/MPL/ |
| 737 | |
| 738 | <p>Software distributed under the License is distributed on an "AS IS" |
| 739 | basis, WITHOUT WARRANTY OF <br>ANY KIND, either express or implied. |
| 740 | See the License for the specific language governing rights and |
| 741 | <br>limitations under the License. |
| 742 | |
| 743 | <p>The Original Code is Javassist. |
| 744 | |
| 745 | <p>The Initial Developer of the Original Code is Shigeru Chiba. |
| 746 | Portions created by the Initial Developer are<br> |
| 747 | Copyright (C) 1999-2010 Shigeru Chiba. All Rights Reserved. |
| 748 | <p>Contributor(s): ______________________________________. |
| 749 | |
| 750 | <p>Alternatively, the contents of this software may be used under the |
| 751 | terms of the GNU Lesser General Public License Version 2.1 or later |
| 752 | (the "LGPL"), in which case the provisions of the LGPL are applicable |
| 753 | instead of those above. If you wish to allow use of your version of |
| 754 | this software only under the terms of the LGPL, and not to allow others to |
| 755 | use your version of this software under the terms of the MPL, indicate |
| 756 | your decision by deleting the provisions above and replace them with |
| 757 | the notice and other provisions required by the LGPL. If you do not |
| 758 | delete the provisions above, a recipient may use your version of this |
| 759 | software under the terms of either the MPL or the LGPL. |
| 760 | |
| 761 | <p>If you obtain this software as part of JBoss, the contents of this |
| 762 | software may be used under only the terms of the LGPL. To use them |
| 763 | under the MPL, you must obtain a separate package including only |
| 764 | Javassist but not the other part of JBoss. |
| 765 | |
| 766 | <p>All the contributors to the original source tree must agree to |
| 767 | the original license term described above. |
| 768 | |
| 769 | <p><br> |
| 770 | |
| 771 | <h2>Acknowledgments</h2> |
| 772 | |
| 773 | <p>The development of this software is sponsored in part by the PRESTO |
| 774 | and CREST programs of <a href="http://www.jst.go.jp/">Japan |
| 775 | Science and Technology Corporation</a>. |
| 776 | |
| 777 | <p>I'd like to thank Michiaki Tatsubori, Johan Cloetens, |
| 778 | Philip Tomlinson, Alex Villazon, Pascal Rapicault, Dan HE, Eric Tanter, |
| 779 | Michael Haupt, Toshiyuki Sasaki, Renaud Pawlak, Luc Bourlier, |
| 780 | Eric Bui, Lewis Stiller, Susumu Yamazaki, Rodrigo Teruo Tomita, |
| 781 | Marc Segura-Devillechaise, Jan Baudisch, Julien Blass, Yoshiki Sato, |
| 782 | Fabian Crabus, Bo Norregaard Jorgensen, Bob Lee, Bill Burke, |
| 783 | Remy Sanlaville, Muga Nishizawa, Alexey Loubyansky, Saori Oki, |
| 784 | Andreas Salathe, Dante Torres estrada, S. Pam, Nuno Santos, |
| 785 | Denis Taye, Colin Sampaleanu, Robert Bialek, Asato Shimotaki, |
| 786 | Howard Lewis Ship, Richard Jones, Marjan Sterjev, |
| 787 | Bruce McDonald, Mark Brennan, Vlad Skarzhevskyy, |
| 788 | Brett Randall, Tsuyoshi Murakami, Nathan Meyers, Yoshiyuki Usui |
| 789 | Yutaka Sunaga, Arjan van der Meer, Bruce Eckel, Guillaume Pothier, |
| 790 | Kumar Matcha, Andreas Salathe, Renat Zubairov, Armin Haaf, |
| 791 | Emmanuel Bernard |
| 792 | and all other contributors for their contributions. |
| 793 | |
| 794 | <p><br> |
| 795 | |
| 796 | <hr> |
| 797 | <a href="http://www.is.titech.ac.jp/~chiba">Shigeru Chiba</a> |
| 798 | (Email: <tt>chiba@acm.org</tt>) |
| 799 | <br>Dept. of Math. and Computing Sciences, |
| 800 | <a href="http://www.titech.ac.jp">Tokyo Institute of Technology</a> |