You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Readme.html 27KB

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