[jboss-cvs] javassist SVN: r533 - in tags: rel_3_12_0_ga and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 15 12:22:16 EDT 2010
Author: chiba
Date: 2010-04-15 12:22:14 -0400 (Thu, 15 Apr 2010)
New Revision: 533
Added:
tags/rel_3_12_0_ga/
tags/rel_3_12_0_ga/License.html
tags/rel_3_12_0_ga/Readme.html
tags/rel_3_12_0_ga/build.xml
tags/rel_3_12_0_ga/pom.xml
tags/rel_3_12_0_ga/src/main/META-INF/MANIFEST.MF
tags/rel_3_12_0_ga/src/main/javassist/CtClass.java
tags/rel_3_12_0_ga/src/main/javassist/bytecode/CodeAttribute.java
tags/rel_3_12_0_ga/src/main/javassist/bytecode/StackMap.java
tags/rel_3_12_0_ga/src/main/javassist/bytecode/annotation/Annotation.java
tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectInputStream.java
tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectOutputStream.java
Removed:
tags/rel_3_12_0_ga/License.html
tags/rel_3_12_0_ga/Readme.html
tags/rel_3_12_0_ga/build.xml
tags/rel_3_12_0_ga/pom.xml
tags/rel_3_12_0_ga/src/main/META-INF/MANIFEST.MF
tags/rel_3_12_0_ga/src/main/javassist/CtClass.java
tags/rel_3_12_0_ga/src/main/javassist/bytecode/CodeAttribute.java
tags/rel_3_12_0_ga/src/main/javassist/bytecode/StackMap.java
tags/rel_3_12_0_ga/src/main/javassist/bytecode/annotation/Annotation.java
tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectInputStream.java
tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectOutputStream.java
Log:
3.12.0.GA relaese
Copied: tags/rel_3_12_0_ga (from rev 527, trunk)
Deleted: tags/rel_3_12_0_ga/License.html
===================================================================
--- trunk/License.html 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/License.html 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,372 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Javassist License</TITLE>
-<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<META content="MSHTML 5.50.4916.2300" name=GENERATOR></HEAD>
-
-<BODY text=#000000 vLink=#551a8b aLink=#ff0000 link=#0000ee bgColor=#ffffff>
-<CENTER><B><FONT size=+2>MOZILLA PUBLIC LICENSE</FONT></B> <BR><B>Version
-1.1</B>
-<P>
-<HR width="20%">
-</CENTER>
-<P><B>1. Definitions.</B>
-<UL><B>1.0.1. "Commercial Use" </B>means distribution or otherwise making the
- Covered Code available to a third party.
- <P><B>1.1. ''Contributor''</B> means each entity that creates or contributes
- to the creation of Modifications.
- <P><B>1.2. ''Contributor Version''</B> means the combination of the Original
- Code, prior Modifications used by a Contributor, and the Modifications made by
- that particular Contributor.
- <P><B>1.3. ''Covered Code''</B> means the Original Code or Modifications or
- the combination of the Original Code and Modifications, in each case including
- portions thereof<B>.</B>
- <P><B>1.4. ''Electronic Distribution Mechanism''</B> means a mechanism
- generally accepted in the software development community for the electronic
- transfer of data.
- <P><B>1.5. ''Executable''</B> means Covered Code in any form other than Source
- Code.
- <P><B>1.6. ''Initial Developer''</B> means the individual or entity identified
- as the Initial Developer in the Source Code notice required by <B>Exhibit
- A</B>.
- <P><B>1.7. ''Larger Work''</B> means a work which combines Covered Code or
- portions thereof with code not governed by the terms of this License.
- <P><B>1.8. ''License''</B> means this document.
- <P><B>1.8.1. "Licensable"</B> means having the right to grant, to the maximum
- extent possible, whether at the time of the initial grant or subsequently
- acquired, any and all of the rights conveyed herein.
- <P><B>1.9. ''Modifications''</B> means any addition to or deletion from the
- substance or structure of either the Original Code or any previous
- Modifications. When Covered Code is released as a series of files, a
- Modification is:
- <UL><B>A.</B> Any addition to or deletion from the contents of a file
- containing Original Code or previous Modifications.
- <P><B>B.</B> Any new file that contains any part of the Original Code or
- previous Modifications. <BR> </P></UL><B>1.10. ''Original Code''</B>
- means Source Code of computer software code which is described in the Source
- Code notice required by <B>Exhibit A</B> as Original Code, and which, at the
- time of its release under this License is not already Covered Code governed by
- this License.
- <P><B>1.10.1. "Patent Claims"</B> means any patent claim(s), now owned or
- hereafter acquired, including without limitation, method, process, and
- apparatus claims, in any patent Licensable by grantor.
- <P><B>1.11. ''Source Code''</B> means the preferred form of the Covered Code
- for making modifications to it, including all modules it contains, plus any
- associated interface definition files, scripts used to control compilation and
- installation of an Executable, or source code differential comparisons against
- either the Original Code or another well known, available Covered Code of the
- Contributor's choice. The Source Code can be in a compressed or archival form,
- provided the appropriate decompression or de-archiving software is widely
- available for no charge.
- <P><B>1.12. "You'' (or "Your") </B> means an individual or a legal entity
- exercising rights under, and complying with all of the terms of, this License
- or a future version of this License issued under Section 6.1. For legal
- entities, "You'' includes any entity which controls, is controlled by, or is
- under common control with You. For purposes of this definition, "control''
- means (a) the power, direct or indirect, to cause the direction or management
- of such entity, whether by contract or otherwise, or (b) ownership of more
- than fifty percent (50%) of the outstanding shares or beneficial ownership of
- such entity.</P></UL><B>2. Source Code License.</B>
-<UL><B>2.1. The Initial Developer Grant.</B> <BR>The Initial Developer hereby
- grants You a world-wide, royalty-free, non-exclusive license, subject to third
- party intellectual property claims:
- <UL><B>(a)</B> <B> </B>under intellectual property rights (other than
- patent or trademark) Licensable by Initial Developer to use, reproduce,
- modify, display, perform, sublicense and distribute the Original Code (or
- portions thereof) with or without Modifications, and/or as part of a Larger
- Work; and
- <P><B>(b)</B> under Patents Claims infringed by the making, using or selling
- of Original Code, to make, have made, use, practice, sell, and offer for
- sale, and/or otherwise dispose of the Original Code (or portions thereof).
- <UL>
- <UL></UL></UL><B>(c) </B>the licenses granted in this Section 2.1(a) and (b)
- are effective on the date Initial Developer first distributes Original Code
- under the terms of this License.
- <P><B>(d) </B>Notwithstanding Section 2.1(b) above, no patent license is
- granted: 1) for code that You delete from the Original Code; 2) separate
- from the Original Code; or 3) for infringements caused by: i) the
- modification of the Original Code or ii) the combination of the Original
- Code with other software or devices. <BR> </P></UL><B>2.2. Contributor
- Grant.</B> <BR>Subject to third party intellectual property claims, each
- Contributor hereby grants You a world-wide, royalty-free, non-exclusive
- license
- <UL> <BR><B>(a)</B> <B> </B>under intellectual property rights (other
- than patent or trademark) Licensable by Contributor, to use, reproduce,
- modify, display, perform, sublicense and distribute the Modifications
- created by such Contributor (or portions thereof) either on an unmodified
- basis, with other Modifications, as Covered Code and/or as part of a Larger
- Work; and
- <P><B>(b)</B> under Patent Claims infringed by the making, using, or selling
- of Modifications made by that Contributor either alone and/or in<FONT
- color=#000000> combination with its Contributor Version (or portions of such
- combination), to make, use, sell, offer for sale, have made, and/or
- otherwise dispose of: 1) Modifications made by that Contributor (or portions
- thereof); and 2) the combination of Modifications made by that
- Contributor with its Contributor Version (or portions of such
- combination).</FONT>
- <P><B>(c) </B>the licenses granted in Sections 2.2(a) and 2.2(b) are
- effective on the date Contributor first makes Commercial Use of the Covered
- Code.
- <P><B>(d) </B> Notwithstanding Section 2.2(b) above, no
- patent license is granted: 1) for any code that Contributor has deleted from
- the Contributor Version; 2) separate from the Contributor
- Version; 3) for infringements caused by: i) third party
- modifications of Contributor Version or ii) the combination of
- Modifications made by that Contributor with other software (except as
- part of the Contributor Version) or other devices; or 4) under Patent Claims
- infringed by Covered Code in the absence of Modifications made by that
- Contributor.</P></UL></UL>
-<P><BR><B>3. Distribution Obligations.</B>
-<UL><B>3.1. Application of License.</B> <BR>The Modifications which You create
- or to which You contribute are governed by the terms of this License,
- including without limitation Section <B>2.2</B>. The Source Code version of
- Covered Code may be distributed only under the terms of this License or a
- future version of this License released under Section <B>6.1</B>, and You must
- include a copy of this License with every copy of the Source Code You
- distribute. You may not offer or impose any terms on any Source Code version
- that alters or restricts the applicable version of this License or the
- recipients' rights hereunder. However, You may include an additional document
- offering the additional rights described in Section <B>3.5</B>.
- <P><B>3.2. Availability of Source Code.</B> <BR>Any Modification which You
- create or to which You contribute must be made available in Source Code form
- under the terms of this License either on the same media as an Executable
- version or via an accepted Electronic Distribution Mechanism to anyone to whom
- you made an Executable version available; and if made available via Electronic
- Distribution Mechanism, must remain available for at least twelve (12) months
- after the date it initially became available, or at least six (6) months after
- a subsequent version of that particular Modification has been made available
- to such recipients. You are responsible for ensuring that the Source Code
- version remains available even if the Electronic Distribution Mechanism is
- maintained by a third party.
- <P><B>3.3. Description of Modifications.</B> <BR>You must cause all Covered
- Code to which You contribute to contain a file documenting the changes You
- made to create that Covered Code and the date of any change. You must include
- a prominent statement that the Modification is derived, directly or
- indirectly, from Original Code provided by the Initial Developer and including
- the name of the Initial Developer in (a) the Source Code, and (b) in any
- notice in an Executable version or related documentation in which You describe
- the origin or ownership of the Covered Code.
- <P><B>3.4. Intellectual Property Matters</B>
- <UL><B>(a) Third Party Claims</B>. <BR>If Contributor has knowledge that a
- license under a third party's intellectual property rights is required to
- exercise the rights granted by such Contributor under Sections 2.1 or 2.2,
- Contributor must include a text file with the Source Code distribution
- titled "LEGAL'' which describes the claim and the party making the claim in
- sufficient detail that a recipient will know whom to contact. If Contributor
- obtains such knowledge after the Modification is made available as described
- in Section 3.2, Contributor shall promptly modify the LEGAL file in all
- copies Contributor makes available thereafter and shall take other steps
- (such as notifying appropriate mailing lists or newsgroups) reasonably
- calculated to inform those who received the Covered Code that new knowledge
- has been obtained.
- <P><B>(b) Contributor APIs</B>. <BR>If Contributor's Modifications include
- an application programming interface and Contributor has knowledge of patent
- licenses which are reasonably necessary to implement that API, Contributor
- must also include this information in the LEGAL file.
- <BR> </P></UL>
- <B>(c) Representations.</B>
- <UL>Contributor represents that, except as disclosed pursuant to Section
- 3.4(a) above, Contributor believes that Contributor's Modifications are
- Contributor's original creation(s) and/or Contributor has sufficient rights
- to grant the rights conveyed by this License.</UL>
- <P><BR><B>3.5. Required Notices.</B> <BR>You must duplicate the notice in
- <B>Exhibit A</B> in each file of the Source Code. If it is not possible
- to put such notice in a particular Source Code file due to its structure, then
- You must include such notice in a location (such as a relevant directory)
- where a user would be likely to look for such a notice. If You created
- one or more Modification(s) You may add your name as a Contributor to the
- notice described in <B>Exhibit A</B>. You must also duplicate this
- License in any documentation for the Source Code where You describe
- recipients' rights or ownership rights relating to Covered Code. You may
- choose to offer, and to charge a fee for, warranty, support, indemnity or
- liability obligations to one or more recipients of Covered Code. However, You
- may do so only on Your own behalf, and not on behalf of the Initial Developer
- or any Contributor. You must make it absolutely clear than any such warranty,
- support, indemnity or liability obligation is offered by You alone, and You
- hereby agree to indemnify the Initial Developer and every Contributor for any
- liability incurred by the Initial Developer or such Contributor as a result of
- warranty, support, indemnity or liability terms You offer.
- <P><B>3.6. Distribution of Executable Versions.</B> <BR>You may distribute
- Covered Code in Executable form only if the requirements of Section
- <B>3.1-3.5</B> have been met for that Covered Code, and if You include a
- notice stating that the Source Code version of the Covered Code is available
- under the terms of this License, including a description of how and where You
- have fulfilled the obligations of Section <B>3.2</B>. The notice must be
- conspicuously included in any notice in an Executable version, related
- documentation or collateral in which You describe recipients' rights relating
- to the Covered Code. You may distribute the Executable version of Covered Code
- or ownership rights under a license of Your choice, which may contain terms
- different from this License, provided that You are in compliance with the
- terms of this License and that the license for the Executable version does not
- attempt to limit or alter the recipient's rights in the Source Code version
- from the rights set forth in this License. If You distribute the Executable
- version under a different license You must make it absolutely clear that any
- terms which differ from this License are offered by You alone, not by the
- Initial Developer or any Contributor. You hereby agree to indemnify the
- Initial Developer and every Contributor for any liability incurred by the
- Initial Developer or such Contributor as a result of any such terms You offer.
-
- <P><B>3.7. Larger Works.</B> <BR>You may create a Larger Work by combining
- Covered Code with other code not governed by the terms of this License and
- distribute the Larger Work as a single product. In such a case, You must make
- sure the requirements of this License are fulfilled for the Covered
-Code.</P></UL><B>4. Inability to Comply Due to Statute or Regulation.</B>
-<UL>If it is impossible for You to comply with any of the terms of this
- License with respect to some or all of the Covered Code due to statute,
- judicial order, or regulation then You must: (a) comply with the terms of this
- License to the maximum extent possible; and (b) describe the limitations and
- the code they affect. Such description must be included in the LEGAL file
- described in Section <B>3.4</B> and must be included with all distributions of
- the Source Code. Except to the extent prohibited by statute or regulation,
- such description must be sufficiently detailed for a recipient of ordinary
- skill to be able to understand it.</UL><B>5. Application of this License.</B>
-<UL>This License applies to code to which the Initial Developer has attached
- the notice in <B>Exhibit A</B> and to related Covered Code.</UL><B>6. Versions
-of the License.</B>
-<UL><B>6.1. New Versions</B>. <BR>Netscape Communications Corporation
- (''Netscape'') may publish revised and/or new versions of the License from
- time to time. Each version will be given a distinguishing version number.
- <P><B>6.2. Effect of New Versions</B>. <BR>Once Covered Code has been
- published under a particular version of the License, You may always continue
- to use it under the terms of that version. You may also choose to use such
- Covered Code under the terms of any subsequent version of the License
- published by Netscape. No one other than Netscape has the right to modify the
- terms applicable to Covered Code created under this License.
- <P><B>6.3. Derivative Works</B>. <BR>If You create or use a modified version
- of this License (which you may only do in order to apply it to code which is
- not already Covered Code governed by this License), You must (a) rename Your
- license so that the phrases ''Mozilla'', ''MOZILLAPL'', ''MOZPL'',
- ''Netscape'', "MPL", ''NPL'' or any confusingly similar phrase do not appear
- in your license (except to note that your license differs from this License)
- and (b) otherwise make it clear that Your version of the license contains
- terms which differ from the Mozilla Public License and Netscape Public
- License. (Filling in the name of the Initial Developer, Original Code or
- Contributor in the notice described in <B>Exhibit A</B> shall not of
- themselves be deemed to be modifications of this License.)</P></UL><B>7.
-DISCLAIMER OF WARRANTY.</B>
-<UL>COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS'' BASIS, WITHOUT
- WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
- LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE,
- FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE
- QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED
- CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
- OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR
- CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
- DISCLAIMER.</UL><B>8. TERMINATION.</B>
-<UL><B>8.1. </B>This License and the rights granted hereunder will
- terminate automatically if You fail to comply with terms herein and fail to
- cure such breach within 30 days of becoming aware of the breach. All
- sublicenses to the Covered Code which are properly granted shall survive any
- termination of this License. Provisions which, by their nature, must remain in
- effect beyond the termination of this License shall survive.
- <P><B>8.2. </B>If You initiate litigation by asserting a patent
- infringement claim (excluding declatory judgment actions) against Initial
- Developer or a Contributor (the Initial Developer or Contributor against whom
- You file such action is referred to as "Participant") alleging that:
- <P><B>(a) </B>such Participant's Contributor Version directly or
- indirectly infringes any patent, then any and all rights granted by such
- Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon
- 60 days notice from Participant terminate prospectively, unless if within 60
- days after receipt of notice You either: (i) agree in writing to pay
- Participant a mutually agreeable reasonable royalty for Your past and future
- use of Modifications made by such Participant, or (ii) withdraw Your
- litigation claim with respect to the Contributor Version against such
- Participant. If within 60 days of notice, a reasonable royalty and
- payment arrangement are not mutually agreed upon in writing by the parties or
- the litigation claim is not withdrawn, the rights granted by Participant to
- You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of
- the 60 day notice period specified above.
- <P><B>(b)</B> any software, hardware, or device, other than such
- Participant's Contributor Version, directly or indirectly infringes any
- patent, then any rights granted to You by such Participant under Sections
- 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used,
- sold, distributed, or had made, Modifications made by that Participant.
- <P><B>8.3. </B>If You assert a patent infringement claim against
- Participant alleging that such Participant's Contributor Version directly or
- indirectly infringes any patent where such claim is resolved (such as by
- license or settlement) prior to the initiation of patent infringement
- litigation, then the reasonable value of the licenses granted by such
- Participant under Sections 2.1 or 2.2 shall be taken into account in
- determining the amount or value of any payment or license.
- <P><B>8.4.</B> In the event of termination under Sections 8.1 or 8.2
- above, all end user license agreements (excluding distributors and
- resellers) which have been validly granted by You or any distributor hereunder
- prior to termination shall survive termination.</P></UL><B>9. LIMITATION OF
-LIABILITY.</B>
-<UL>UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING
- NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY
- OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY
- OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL,
- INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
- LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR
- MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH
- PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS
- LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
- INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
- PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
- LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND
- LIMITATION MAY NOT APPLY TO YOU.</UL><B>10. U.S. GOVERNMENT END USERS.</B>
-<UL>The Covered Code is a ''commercial item,'' as that term is defined in 48
- C.F.R. 2.101 (Oct. 1995), consisting of ''commercial computer software'' and
- ''commercial computer software documentation,'' as such terms are used in 48
- C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R.
- 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users
- acquire Covered Code with only those rights set forth herein.</UL><B>11.
-MISCELLANEOUS.</B>
-<UL>This License represents the complete agreement concerning subject matter
- hereof. If any provision of this License is held to be unenforceable, such
- provision shall be reformed only to the extent necessary to make it
- enforceable. This License shall be governed by California law provisions
- (except to the extent applicable law, if any, provides otherwise), excluding
- its conflict-of-law provisions. With respect to disputes in which at least one
- party is a citizen of, or an entity chartered or registered to do business in
- the United States of America, any litigation relating to this License shall be
- subject to the jurisdiction of the Federal Courts of the Northern District of
- California, with venue lying in Santa Clara County, California, with the
- losing party responsible for costs, including without limitation, court costs
- and reasonable attorneys' fees and expenses. The application of the United
- Nations Convention on Contracts for the International Sale of Goods is
- expressly excluded. Any law or regulation which provides that the language of
- a contract shall be construed against the drafter shall not apply to this
- License.</UL><B>12. RESPONSIBILITY FOR CLAIMS.</B>
-<UL>As between Initial Developer and the Contributors, each party is
- responsible for claims and damages arising, directly or indirectly, out of its
- utilization of rights under this License and You agree to work with Initial
- Developer and Contributors to distribute such responsibility on an equitable
- basis. Nothing herein is intended or shall be deemed to constitute any
- admission of liability.</UL><B>13. MULTIPLE-LICENSED CODE.</B>
-<UL>Initial Developer may designate portions of the Covered Code as
- �Multiple-Licensed?. �Multiple-Licensed? means that the Initial
- Developer permits you to utilize portions of the Covered Code under Your
- choice of the MPL or the alternative licenses, if any, specified by the
- Initial Developer in the file described in Exhibit A.</UL>
-<P><BR><B>EXHIBIT A -Mozilla Public License.</B>
-<UL>The contents of this file are subject to the Mozilla Public License
- Version 1.1 (the "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
- <BR>http://www.mozilla.org/MPL/
- <P>Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF <BR>ANY KIND, either express or implied. See the License
- for the specific language governing rights and <BR>limitations under the
- License.
- <P>The Original Code is Javassist.
- <P>The Initial Developer of the Original Code is Shigeru Chiba.
- Portions created by the Initial Developer are<BR>
- Copyright (C) 1999-2009 Shigeru Chiba. All Rights Reserved.
- <P>Contributor(s): ______________________________________.
-
- <P>Alternatively, the contents of this file may be used under the terms of
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of either the MPL or the LGPL.
-
- <P></P></UL>
-</BODY>
-</HTML>
Copied: tags/rel_3_12_0_ga/License.html (from rev 528, trunk/License.html)
===================================================================
--- tags/rel_3_12_0_ga/License.html (rev 0)
+++ tags/rel_3_12_0_ga/License.html 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,372 @@
+<HTML>
+<HEAD>
+<TITLE>Javassist License</TITLE>
+<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<META content="MSHTML 5.50.4916.2300" name=GENERATOR></HEAD>
+
+<BODY text=#000000 vLink=#551a8b aLink=#ff0000 link=#0000ee bgColor=#ffffff>
+<CENTER><B><FONT size=+2>MOZILLA PUBLIC LICENSE</FONT></B> <BR><B>Version
+1.1</B>
+<P>
+<HR width="20%">
+</CENTER>
+<P><B>1. Definitions.</B>
+<UL><B>1.0.1. "Commercial Use" </B>means distribution or otherwise making the
+ Covered Code available to a third party.
+ <P><B>1.1. ''Contributor''</B> means each entity that creates or contributes
+ to the creation of Modifications.
+ <P><B>1.2. ''Contributor Version''</B> means the combination of the Original
+ Code, prior Modifications used by a Contributor, and the Modifications made by
+ that particular Contributor.
+ <P><B>1.3. ''Covered Code''</B> means the Original Code or Modifications or
+ the combination of the Original Code and Modifications, in each case including
+ portions thereof<B>.</B>
+ <P><B>1.4. ''Electronic Distribution Mechanism''</B> means a mechanism
+ generally accepted in the software development community for the electronic
+ transfer of data.
+ <P><B>1.5. ''Executable''</B> means Covered Code in any form other than Source
+ Code.
+ <P><B>1.6. ''Initial Developer''</B> means the individual or entity identified
+ as the Initial Developer in the Source Code notice required by <B>Exhibit
+ A</B>.
+ <P><B>1.7. ''Larger Work''</B> means a work which combines Covered Code or
+ portions thereof with code not governed by the terms of this License.
+ <P><B>1.8. ''License''</B> means this document.
+ <P><B>1.8.1. "Licensable"</B> means having the right to grant, to the maximum
+ extent possible, whether at the time of the initial grant or subsequently
+ acquired, any and all of the rights conveyed herein.
+ <P><B>1.9. ''Modifications''</B> means any addition to or deletion from the
+ substance or structure of either the Original Code or any previous
+ Modifications. When Covered Code is released as a series of files, a
+ Modification is:
+ <UL><B>A.</B> Any addition to or deletion from the contents of a file
+ containing Original Code or previous Modifications.
+ <P><B>B.</B> Any new file that contains any part of the Original Code or
+ previous Modifications. <BR> </P></UL><B>1.10. ''Original Code''</B>
+ means Source Code of computer software code which is described in the Source
+ Code notice required by <B>Exhibit A</B> as Original Code, and which, at the
+ time of its release under this License is not already Covered Code governed by
+ this License.
+ <P><B>1.10.1. "Patent Claims"</B> means any patent claim(s), now owned or
+ hereafter acquired, including without limitation, method, process, and
+ apparatus claims, in any patent Licensable by grantor.
+ <P><B>1.11. ''Source Code''</B> means the preferred form of the Covered Code
+ for making modifications to it, including all modules it contains, plus any
+ associated interface definition files, scripts used to control compilation and
+ installation of an Executable, or source code differential comparisons against
+ either the Original Code or another well known, available Covered Code of the
+ Contributor's choice. The Source Code can be in a compressed or archival form,
+ provided the appropriate decompression or de-archiving software is widely
+ available for no charge.
+ <P><B>1.12. "You'' (or "Your") </B> means an individual or a legal entity
+ exercising rights under, and complying with all of the terms of, this License
+ or a future version of this License issued under Section 6.1. For legal
+ entities, "You'' includes any entity which controls, is controlled by, or is
+ under common control with You. For purposes of this definition, "control''
+ means (a) the power, direct or indirect, to cause the direction or management
+ of such entity, whether by contract or otherwise, or (b) ownership of more
+ than fifty percent (50%) of the outstanding shares or beneficial ownership of
+ such entity.</P></UL><B>2. Source Code License.</B>
+<UL><B>2.1. The Initial Developer Grant.</B> <BR>The Initial Developer hereby
+ grants You a world-wide, royalty-free, non-exclusive license, subject to third
+ party intellectual property claims:
+ <UL><B>(a)</B> <B> </B>under intellectual property rights (other than
+ patent or trademark) Licensable by Initial Developer to use, reproduce,
+ modify, display, perform, sublicense and distribute the Original Code (or
+ portions thereof) with or without Modifications, and/or as part of a Larger
+ Work; and
+ <P><B>(b)</B> under Patents Claims infringed by the making, using or selling
+ of Original Code, to make, have made, use, practice, sell, and offer for
+ sale, and/or otherwise dispose of the Original Code (or portions thereof).
+ <UL>
+ <UL></UL></UL><B>(c) </B>the licenses granted in this Section 2.1(a) and (b)
+ are effective on the date Initial Developer first distributes Original Code
+ under the terms of this License.
+ <P><B>(d) </B>Notwithstanding Section 2.1(b) above, no patent license is
+ granted: 1) for code that You delete from the Original Code; 2) separate
+ from the Original Code; or 3) for infringements caused by: i) the
+ modification of the Original Code or ii) the combination of the Original
+ Code with other software or devices. <BR> </P></UL><B>2.2. Contributor
+ Grant.</B> <BR>Subject to third party intellectual property claims, each
+ Contributor hereby grants You a world-wide, royalty-free, non-exclusive
+ license
+ <UL> <BR><B>(a)</B> <B> </B>under intellectual property rights (other
+ than patent or trademark) Licensable by Contributor, to use, reproduce,
+ modify, display, perform, sublicense and distribute the Modifications
+ created by such Contributor (or portions thereof) either on an unmodified
+ basis, with other Modifications, as Covered Code and/or as part of a Larger
+ Work; and
+ <P><B>(b)</B> under Patent Claims infringed by the making, using, or selling
+ of Modifications made by that Contributor either alone and/or in<FONT
+ color=#000000> combination with its Contributor Version (or portions of such
+ combination), to make, use, sell, offer for sale, have made, and/or
+ otherwise dispose of: 1) Modifications made by that Contributor (or portions
+ thereof); and 2) the combination of Modifications made by that
+ Contributor with its Contributor Version (or portions of such
+ combination).</FONT>
+ <P><B>(c) </B>the licenses granted in Sections 2.2(a) and 2.2(b) are
+ effective on the date Contributor first makes Commercial Use of the Covered
+ Code.
+ <P><B>(d) </B> Notwithstanding Section 2.2(b) above, no
+ patent license is granted: 1) for any code that Contributor has deleted from
+ the Contributor Version; 2) separate from the Contributor
+ Version; 3) for infringements caused by: i) third party
+ modifications of Contributor Version or ii) the combination of
+ Modifications made by that Contributor with other software (except as
+ part of the Contributor Version) or other devices; or 4) under Patent Claims
+ infringed by Covered Code in the absence of Modifications made by that
+ Contributor.</P></UL></UL>
+<P><BR><B>3. Distribution Obligations.</B>
+<UL><B>3.1. Application of License.</B> <BR>The Modifications which You create
+ or to which You contribute are governed by the terms of this License,
+ including without limitation Section <B>2.2</B>. The Source Code version of
+ Covered Code may be distributed only under the terms of this License or a
+ future version of this License released under Section <B>6.1</B>, and You must
+ include a copy of this License with every copy of the Source Code You
+ distribute. You may not offer or impose any terms on any Source Code version
+ that alters or restricts the applicable version of this License or the
+ recipients' rights hereunder. However, You may include an additional document
+ offering the additional rights described in Section <B>3.5</B>.
+ <P><B>3.2. Availability of Source Code.</B> <BR>Any Modification which You
+ create or to which You contribute must be made available in Source Code form
+ under the terms of this License either on the same media as an Executable
+ version or via an accepted Electronic Distribution Mechanism to anyone to whom
+ you made an Executable version available; and if made available via Electronic
+ Distribution Mechanism, must remain available for at least twelve (12) months
+ after the date it initially became available, or at least six (6) months after
+ a subsequent version of that particular Modification has been made available
+ to such recipients. You are responsible for ensuring that the Source Code
+ version remains available even if the Electronic Distribution Mechanism is
+ maintained by a third party.
+ <P><B>3.3. Description of Modifications.</B> <BR>You must cause all Covered
+ Code to which You contribute to contain a file documenting the changes You
+ made to create that Covered Code and the date of any change. You must include
+ a prominent statement that the Modification is derived, directly or
+ indirectly, from Original Code provided by the Initial Developer and including
+ the name of the Initial Developer in (a) the Source Code, and (b) in any
+ notice in an Executable version or related documentation in which You describe
+ the origin or ownership of the Covered Code.
+ <P><B>3.4. Intellectual Property Matters</B>
+ <UL><B>(a) Third Party Claims</B>. <BR>If Contributor has knowledge that a
+ license under a third party's intellectual property rights is required to
+ exercise the rights granted by such Contributor under Sections 2.1 or 2.2,
+ Contributor must include a text file with the Source Code distribution
+ titled "LEGAL'' which describes the claim and the party making the claim in
+ sufficient detail that a recipient will know whom to contact. If Contributor
+ obtains such knowledge after the Modification is made available as described
+ in Section 3.2, Contributor shall promptly modify the LEGAL file in all
+ copies Contributor makes available thereafter and shall take other steps
+ (such as notifying appropriate mailing lists or newsgroups) reasonably
+ calculated to inform those who received the Covered Code that new knowledge
+ has been obtained.
+ <P><B>(b) Contributor APIs</B>. <BR>If Contributor's Modifications include
+ an application programming interface and Contributor has knowledge of patent
+ licenses which are reasonably necessary to implement that API, Contributor
+ must also include this information in the LEGAL file.
+ <BR> </P></UL>
+ <B>(c) Representations.</B>
+ <UL>Contributor represents that, except as disclosed pursuant to Section
+ 3.4(a) above, Contributor believes that Contributor's Modifications are
+ Contributor's original creation(s) and/or Contributor has sufficient rights
+ to grant the rights conveyed by this License.</UL>
+ <P><BR><B>3.5. Required Notices.</B> <BR>You must duplicate the notice in
+ <B>Exhibit A</B> in each file of the Source Code. If it is not possible
+ to put such notice in a particular Source Code file due to its structure, then
+ You must include such notice in a location (such as a relevant directory)
+ where a user would be likely to look for such a notice. If You created
+ one or more Modification(s) You may add your name as a Contributor to the
+ notice described in <B>Exhibit A</B>. You must also duplicate this
+ License in any documentation for the Source Code where You describe
+ recipients' rights or ownership rights relating to Covered Code. You may
+ choose to offer, and to charge a fee for, warranty, support, indemnity or
+ liability obligations to one or more recipients of Covered Code. However, You
+ may do so only on Your own behalf, and not on behalf of the Initial Developer
+ or any Contributor. You must make it absolutely clear than any such warranty,
+ support, indemnity or liability obligation is offered by You alone, and You
+ hereby agree to indemnify the Initial Developer and every Contributor for any
+ liability incurred by the Initial Developer or such Contributor as a result of
+ warranty, support, indemnity or liability terms You offer.
+ <P><B>3.6. Distribution of Executable Versions.</B> <BR>You may distribute
+ Covered Code in Executable form only if the requirements of Section
+ <B>3.1-3.5</B> have been met for that Covered Code, and if You include a
+ notice stating that the Source Code version of the Covered Code is available
+ under the terms of this License, including a description of how and where You
+ have fulfilled the obligations of Section <B>3.2</B>. The notice must be
+ conspicuously included in any notice in an Executable version, related
+ documentation or collateral in which You describe recipients' rights relating
+ to the Covered Code. You may distribute the Executable version of Covered Code
+ or ownership rights under a license of Your choice, which may contain terms
+ different from this License, provided that You are in compliance with the
+ terms of this License and that the license for the Executable version does not
+ attempt to limit or alter the recipient's rights in the Source Code version
+ from the rights set forth in this License. If You distribute the Executable
+ version under a different license You must make it absolutely clear that any
+ terms which differ from this License are offered by You alone, not by the
+ Initial Developer or any Contributor. You hereby agree to indemnify the
+ Initial Developer and every Contributor for any liability incurred by the
+ Initial Developer or such Contributor as a result of any such terms You offer.
+
+ <P><B>3.7. Larger Works.</B> <BR>You may create a Larger Work by combining
+ Covered Code with other code not governed by the terms of this License and
+ distribute the Larger Work as a single product. In such a case, You must make
+ sure the requirements of this License are fulfilled for the Covered
+Code.</P></UL><B>4. Inability to Comply Due to Statute or Regulation.</B>
+<UL>If it is impossible for You to comply with any of the terms of this
+ License with respect to some or all of the Covered Code due to statute,
+ judicial order, or regulation then You must: (a) comply with the terms of this
+ License to the maximum extent possible; and (b) describe the limitations and
+ the code they affect. Such description must be included in the LEGAL file
+ described in Section <B>3.4</B> and must be included with all distributions of
+ the Source Code. Except to the extent prohibited by statute or regulation,
+ such description must be sufficiently detailed for a recipient of ordinary
+ skill to be able to understand it.</UL><B>5. Application of this License.</B>
+<UL>This License applies to code to which the Initial Developer has attached
+ the notice in <B>Exhibit A</B> and to related Covered Code.</UL><B>6. Versions
+of the License.</B>
+<UL><B>6.1. New Versions</B>. <BR>Netscape Communications Corporation
+ (''Netscape'') may publish revised and/or new versions of the License from
+ time to time. Each version will be given a distinguishing version number.
+ <P><B>6.2. Effect of New Versions</B>. <BR>Once Covered Code has been
+ published under a particular version of the License, You may always continue
+ to use it under the terms of that version. You may also choose to use such
+ Covered Code under the terms of any subsequent version of the License
+ published by Netscape. No one other than Netscape has the right to modify the
+ terms applicable to Covered Code created under this License.
+ <P><B>6.3. Derivative Works</B>. <BR>If You create or use a modified version
+ of this License (which you may only do in order to apply it to code which is
+ not already Covered Code governed by this License), You must (a) rename Your
+ license so that the phrases ''Mozilla'', ''MOZILLAPL'', ''MOZPL'',
+ ''Netscape'', "MPL", ''NPL'' or any confusingly similar phrase do not appear
+ in your license (except to note that your license differs from this License)
+ and (b) otherwise make it clear that Your version of the license contains
+ terms which differ from the Mozilla Public License and Netscape Public
+ License. (Filling in the name of the Initial Developer, Original Code or
+ Contributor in the notice described in <B>Exhibit A</B> shall not of
+ themselves be deemed to be modifications of this License.)</P></UL><B>7.
+DISCLAIMER OF WARRANTY.</B>
+<UL>COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS'' BASIS, WITHOUT
+ WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+ LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE,
+ FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE
+ QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED
+ CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
+ OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR
+ CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
+ LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+ DISCLAIMER.</UL><B>8. TERMINATION.</B>
+<UL><B>8.1. </B>This License and the rights granted hereunder will
+ terminate automatically if You fail to comply with terms herein and fail to
+ cure such breach within 30 days of becoming aware of the breach. All
+ sublicenses to the Covered Code which are properly granted shall survive any
+ termination of this License. Provisions which, by their nature, must remain in
+ effect beyond the termination of this License shall survive.
+ <P><B>8.2. </B>If You initiate litigation by asserting a patent
+ infringement claim (excluding declatory judgment actions) against Initial
+ Developer or a Contributor (the Initial Developer or Contributor against whom
+ You file such action is referred to as "Participant") alleging that:
+ <P><B>(a) </B>such Participant's Contributor Version directly or
+ indirectly infringes any patent, then any and all rights granted by such
+ Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon
+ 60 days notice from Participant terminate prospectively, unless if within 60
+ days after receipt of notice You either: (i) agree in writing to pay
+ Participant a mutually agreeable reasonable royalty for Your past and future
+ use of Modifications made by such Participant, or (ii) withdraw Your
+ litigation claim with respect to the Contributor Version against such
+ Participant. If within 60 days of notice, a reasonable royalty and
+ payment arrangement are not mutually agreed upon in writing by the parties or
+ the litigation claim is not withdrawn, the rights granted by Participant to
+ You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of
+ the 60 day notice period specified above.
+ <P><B>(b)</B> any software, hardware, or device, other than such
+ Participant's Contributor Version, directly or indirectly infringes any
+ patent, then any rights granted to You by such Participant under Sections
+ 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used,
+ sold, distributed, or had made, Modifications made by that Participant.
+ <P><B>8.3. </B>If You assert a patent infringement claim against
+ Participant alleging that such Participant's Contributor Version directly or
+ indirectly infringes any patent where such claim is resolved (such as by
+ license or settlement) prior to the initiation of patent infringement
+ litigation, then the reasonable value of the licenses granted by such
+ Participant under Sections 2.1 or 2.2 shall be taken into account in
+ determining the amount or value of any payment or license.
+ <P><B>8.4.</B> In the event of termination under Sections 8.1 or 8.2
+ above, all end user license agreements (excluding distributors and
+ resellers) which have been validly granted by You or any distributor hereunder
+ prior to termination shall survive termination.</P></UL><B>9. LIMITATION OF
+LIABILITY.</B>
+<UL>UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING
+ NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY
+ OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY
+ OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL,
+ INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+ LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR
+ MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH
+ PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS
+ LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+ INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
+ PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
+ LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND
+ LIMITATION MAY NOT APPLY TO YOU.</UL><B>10. U.S. GOVERNMENT END USERS.</B>
+<UL>The Covered Code is a ''commercial item,'' as that term is defined in 48
+ C.F.R. 2.101 (Oct. 1995), consisting of ''commercial computer software'' and
+ ''commercial computer software documentation,'' as such terms are used in 48
+ C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R.
+ 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users
+ acquire Covered Code with only those rights set forth herein.</UL><B>11.
+MISCELLANEOUS.</B>
+<UL>This License represents the complete agreement concerning subject matter
+ hereof. If any provision of this License is held to be unenforceable, such
+ provision shall be reformed only to the extent necessary to make it
+ enforceable. This License shall be governed by California law provisions
+ (except to the extent applicable law, if any, provides otherwise), excluding
+ its conflict-of-law provisions. With respect to disputes in which at least one
+ party is a citizen of, or an entity chartered or registered to do business in
+ the United States of America, any litigation relating to this License shall be
+ subject to the jurisdiction of the Federal Courts of the Northern District of
+ California, with venue lying in Santa Clara County, California, with the
+ losing party responsible for costs, including without limitation, court costs
+ and reasonable attorneys' fees and expenses. The application of the United
+ Nations Convention on Contracts for the International Sale of Goods is
+ expressly excluded. Any law or regulation which provides that the language of
+ a contract shall be construed against the drafter shall not apply to this
+ License.</UL><B>12. RESPONSIBILITY FOR CLAIMS.</B>
+<UL>As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or indirectly, out of its
+ utilization of rights under this License and You agree to work with Initial
+ Developer and Contributors to distribute such responsibility on an equitable
+ basis. Nothing herein is intended or shall be deemed to constitute any
+ admission of liability.</UL><B>13. MULTIPLE-LICENSED CODE.</B>
+<UL>Initial Developer may designate portions of the Covered Code as
+ �Multiple-Licensed?. �Multiple-Licensed? means that the Initial
+ Developer permits you to utilize portions of the Covered Code under Your
+ choice of the MPL or the alternative licenses, if any, specified by the
+ Initial Developer in the file described in Exhibit A.</UL>
+<P><BR><B>EXHIBIT A -Mozilla Public License.</B>
+<UL>The contents of this file are subject to the Mozilla Public License
+ Version 1.1 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ <BR>http://www.mozilla.org/MPL/
+ <P>Software distributed under the License is distributed on an "AS IS" basis,
+ WITHOUT WARRANTY OF <BR>ANY KIND, either express or implied. See the License
+ for the specific language governing rights and <BR>limitations under the
+ License.
+ <P>The Original Code is Javassist.
+ <P>The Initial Developer of the Original Code is Shigeru Chiba.
+ Portions created by the Initial Developer are<BR>
+ Copyright (C) 1999-2010 Shigeru Chiba. All Rights Reserved.
+ <P>Contributor(s): ______________________________________.
+
+ <P>Alternatively, the contents of this file may be used under the terms of
+ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ in which case the provisions of the LGPL are applicable instead
+ of those above. If you wish to allow use of your version of this file only
+ under the terms of the LGPL, and not to allow others to
+ use your version of this file under the terms of the MPL, indicate your
+ decision by deleting the provisions above and replace them with the notice
+ and other provisions required by the LGPL. If you do not delete
+ the provisions above, a recipient may use your version of this file under
+ the terms of either the MPL or the LGPL.
+
+ <P></P></UL>
+</BODY>
+</HTML>
Deleted: tags/rel_3_12_0_ga/Readme.html
===================================================================
--- trunk/Readme.html 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/Readme.html 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,790 +0,0 @@
-<html>
-<HEAD>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
- <TITLE>Read Me First</TITLE>
-</HEAD>
-<body>
-
-<h1>Javassist version 3</h1>
-
-<h3>Copyright (C) 1999-2009 by Shigeru Chiba, All rights reserved.</h3>
-
-<p><br></p>
-
-<p>Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation
-simple. It is a class library for editing bytecodes in Java;
-it enables Java programs to define a new class at runtime and to
-modify a class file when the JVM loads it. Unlike other similar
-bytecode editors, Javassist provides two levels of API: source level
-and bytecode level. If the users use the source-level API, they can
-edit a class file without knowledge of the specifications of the Java
-bytecode. The whole API is designed with only the vocabulary of the
-Java language. You can even specify inserted bytecode in the form of
-source text; Javassist compiles it on the fly. On the other hand, the
-bytecode-level API allows the users to directly edit a class file as
-other editors.
-
-<p><br>
-
-<h2>Files</h2>
-
-<ul>
-<table>
-<tr>
-<td><li><tt><a href="License.html">License.html</a></tt></td>
-<td>License file
-(Also see the <a href="#copyright">copyright notices</a> below)</td>
-</tr>
-
-<tr>
-<td><li><tt><a href="tutorial/tutorial.html">tutorial/tutorial.html</a></tt></td>
-<td>Tutorial</td>
-</tr>
-
-<tr>
-<td><li><tt>./javassist.jar</tt></td>
-<td>The Javassist jar file (class files)</td>
-</tr>
-
-<tr>
-<td><li><tt>./src/main</tt></td>
-<td>The source files</td>
-</tr>
-
-<tr>
-<td><li><tt><a href="html/index.html">html/index.html</a></tt></td>
-<td>The top page of the Javassist API document.</td>
-</tr>
-
-<tr>
-<td><li><tt>./sample/</tt></td>
-<td>Sample programs</td>
-</tr>
-</table>
-</ul>
-
-<p><br>
-
-<h2>How to run sample programs</h2>
-
-<p>JDK 1.4 or later is needed.
-
-<h3>0. If you have Apache Ant</h3>
-
-<p>Run the sample-all task.
-Otherwise, follow the instructions below.
-
-<h3>1. Move to the directory where this Readme.html file is located.</h3>
-
-<p>In the following instructions, we assume that the javassist.jar
-file is included in the class path.
-For example, the javac and java commands must receive
-the following <code>classpath</code> option:
-
-<ul><pre>
--classpath ".:javassist.jar"
-</pre></ul>
-
-<p>If the operating system is Windows, the path
-separator must be not <code>:</code> (colon) but
-<code>;</code> (semicolon). The java command can receive
-the <code>-cp</code> option
-as well as <code>-classpath</code>.
-
-<p>If you don't want to use the class-path option, you can make
-<code>javassist.jar</code> included in the <code>CLASSPATH</code>
-environment:
-
-<ul><pre>
-export CLASSPATH=.:javassist.jar
-</pre></ul>
-
-<p>or if the operating system is Windows:
-
-<ul><pre>
-set CLASSPATH=.;javassist.jar
-</pre></ul>
-
-
-<p>Otherwise, you can copy <tt>javassist.jar</tt> to the directory
-
-<ul><<i>java-home</i>><tt>/jre/lib/ext</tt>.</ul>
-
-<p><<i>java-home</i>> depends on the system. It is usually
-<tt>/usr/local/java</tt>, <tt>c:\j2sdk1.4\</tt>, etc.
-
-<h3>2. sample/Test.java</h3>
-
-<p> This is a very simple program using Javassist.
-
-<p> To run, type the commands:
-
-<ul><pre>
-% javac sample/Test.java
-% java sample.Test
-</pre></ul>
-
-<p> For more details, see <a type="text/plain" href="sample/Test.java">sample/Test.java</a>
-
-<h3>3. sample/reflect/*.java</h3>
-
-<p> This is the "verbose metaobject" example well known in reflective
- programming. This program dynamically attaches a metaobject to
- a Person object. The metaobject prints a message if a method
- is called on the Person object.
-
-<p> To run, type the commands:
-
-<ul><pre>
-% javac sample/reflect/*.java
-% java javassist.tools.reflect.Loader sample.reflect.Main Joe
-</pre></ul>
-
-<p>Compare this result with that of the regular execution without reflection:
-
-<ul><pre>% java sample.reflect.Person Joe</pre></ul>
-
-<p> For more details, see <a type="text/plain" href="sample/reflect/Main.java">sample/reflect/Main.java</a>
-
-<p> Furthermore, the Person class can be statically modified so that
- all the Person objects become reflective without sample.reflect.Main.
- To do this, type the commands:
-
-<ul><pre>
-% java javassist.tools.reflect.Compiler sample.reflect.Person -m sample.reflect.VerboseMetaobj
-</pre></ul>
-
-<p> Then,
-<ul><pre>
-% java sample.reflect.Person Joe
-</pre></ul>
-
-<h3>4. sample/duplicate/*.java</h3>
-
-<p> This is another example of reflective programming.
-
-<p> To run, type the commands:
-
-<ul><pre>
-% javac sample/duplicate/*.java
-% java sample.duplicate.Main
-</pre></ul>
-
-<p>Compare this result with that of the regular execution without reflection:
-
-<ul><pre>% java sample.duplicate.Viewer</pre></ul>
-
-<p>For more details, see
-<a type="text/plain" href="sample/duplicate/Main.java">sample/duplicate/Main.java</a>
-
-<h3>5. sample/vector/*.java</h3>
-
-<p>This example shows the use of Javassit for producing a class representing
-a vector of a given type at compile time.
-
-<p> To run, type the commands:
-<ul><pre>
-% javac sample/vector/*.java
-% java sample.preproc.Compiler sample/vector/Test.j
-% javac sample/vector/Test.java
-% java sample.vector.Test
-</pre></ul>
-
-<p>Note: <code>javassist.jar</code> is unnecessary to compile and execute
-<code>sample/vector/Test.java</code>.
-
-For more details, see
-<a type="text/plain" href="sample/vector/Test.j">sample/vector/Test.j</a>
-and <a type="text/plain" href="sample/vector/VectorAssistant.java">sample/vector/VectorAssistant.java</a>
-
-<h3>6. sample/rmi/*.java</h3>
-
-<p> This demonstrates the javassist.rmi package.
-
-<p> To run, type the commands:
-<ul><pre>
-% javac sample/rmi/*.java
-% java sample.rmi.Counter 5001
-</pre></ul>
-
-<p> The second line starts a web server listening to port 5001.
-
-<p> Then, open <a href="sample/rmi/webdemo.html">sample/rmi/webdemo.html</a>
-with a web browser running
- on the local host. (<tt>webdemo.html</tt> trys to fetch an applet from
- <tt>http://localhost:5001/</tt>, which is the web server we started above.)
-
-<p> Otherwise, run sample.rmi.CountApplet as an application:
-
-<ul><pre>
-% java javassist.web.Viewer localhost 5001 sample.rmi.CountApplet
-</pre></ul>
-
-<h3>7. sample/evolve/*.java</h3>
-
-<p> This is a demonstration of the class evolution mechanism implemented
- with Javassist. This mechanism enables a Java program to reload an
- existing class file under some restriction.
-
-<p> To run, type the commands:
-<ul><pre>
-% javac sample/evolve/*.java
-% java sample.evolve.DemoLoader 5003
-</pre></ul>
-
-<p> The second line starts a class loader DemoLoader, which runs a web
- server DemoServer listening to port 5003.
-
-<p> Then, open <a href="http://localhost:5003/demo.html">http://localhost:5003/demo.html</a> with a web browser running
- on the local host.
-(Or, see <a href="sample/evolve/start.html">sample/evolve/start.html</a>.)
-
-<h3>8. sample/hotswap/*.java</h3>
-
-<p>This shows dynamic class reloading by the JPDA. It needs JDK 1.4 or later.
-To run, first type the following commands:
-
-<ul><pre>
-% cd sample/hotswap
-% javac *.java
-% cd logging
-% javac *.java
-% cd ..
-</pre></ul>
-
-<p>If your Java is 1.4, then type:
-
-<ul><pre>
-% java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 Test
-</pre></ul>
-
-<p>If you are using Java 5, then type:
-
-<ul><pre>
-% java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 Test
-</pre></ul>
-
-<p>Note that the class path must include <code>JAVA_HOME/lib/tools.jar</code>.
-
-<h2>Hints</h2>
-
-<p>To know the version number, type this command:
-
-<ul><pre>
-% java -jar javassist.jar
-</pre></ul>
-
-<p>Javassist provides a class file viewer for debugging. For more details,
-see javassist.Dump.
-
-<p><br>
-
-<h2>Changes</h2>
-
-<p>-version 3.12
-
-<ul>
- <li>JIRA JASSIST-89, 95
-</ul>
-
-<p>-version 3.11 on July 3, 2009
-<ul>
- <li>JIRA JASSIST-67, 68, 74, 75, 76, 77, 81, 83, 84, 85, 86, 87 were fixed.
- <li>Now javassist.bytecode.CodeIterator can insert a gap into
- a large method body more than 32KB. (JIRA JASSIST-79, 80)
-</ul>
-
-<p>-version 3.10 on March 5, 2009
-
-<ul>
- <li>JIRA JASSIST-69, 70, 71 were fixed.
-</ul>
-
-<p>-version 3.9 on October 9, 2008
-<ul>
- <li>ClassPool.makeClassIfNew(InputStream) was implemented.
- <li>CtNewMethod.wrapped(..) and CtNewConstructor.wrapped(..)
- implicitly append a method like _added_m$0.
- This method now has a synthetic attribute.
- <li>JIRA JASSIST-66 has been fixed.
-</ul>
-
-<p>-version 3.8.1 on July 17, 2008
-<ul>
- <li>CtClass.rebuildClassFile() has been added.
- <li>A few bugs of javassist.bytecode.analysis have been fixed.
- 3.8.0 could not correctly deal with one letter class name
- such as I and J.
-</ul>
-
-<p>-version 3.8.0 on June 13, 2008
-<ul>
- <li>javassist.bytecode.analysis was implemented.
- <li>JASSIST-45, 47, 51, 54-57, 60, 62 were fixed.
-</ul>
-
-<p>-version 3.7.1 on March 10, 2008
-<ul>
- <li>a bug of javassist.util.proxy has been fixed.
-</ul>
-
-<p>-version 3.7 on January 20, 2008
-<ul>
- <li>Several minor bugs have been fixed.
-</ul>
-
-<p>-version 3.6.0 on September 13, 2007
-
-<p>-version 3.6.0.CR1 on July 27, 2007
-
-<ul>
- <li>The stack map table introduced since Java 6 has been supported.
- <li>CtClass#getDeclaredBehaviors() now returns a class initializer
- as well as methods and constructors.
- <li>The default status of automatic pruning was made off.
- Instead of pruning, this version of Javassist compresses
- the data structure of a class file after toBytecode() is called.
- The compressed class file is automatically decompressed when needed.
- This saves memory space better than pruning.
- <li><a href="http://jira.jboss.com/jira/browse/JASSIST-33">JIRA JASSIST-33</a> has been fixed.
-</ul>
-
-<p>-version 3.5 on April 29, 2007
-<ul>
- <li>Various minor updates.
-</ul>
-
-<p>-version 3.4 on November 17, 2006
-<ul>
- <li>A bug in CodeConverter#replaceFieldRead() and CodeConverter#replaceFieldWrite()
- was fixed. <a href="http://jira.jboss.com/jira/browse/JBAOP-284">JBAOP-284</a>.
-
- <li>A synchronization bug and a performance bug in <code>javassist.util.proxy</code>
- have been fixed
- (<a href="http://jira.jboss.com/jira/browse/JASSIST-28">JASSIST-28</a>).
- Now generated proxy classes are cached. To turn the caching off,
- set <code>ProxyFactory.useCache</code> to <code>false</code>.
-</ul>
-
-<p>-version 3.3 on August 17, 2006
-<ul>
- <li>CtClass#toClass() and ClassPool#toClass() were modified to accept a
- <code>ProtectionDomain</code>
- (<a href="http://jira.jboss.com/jira/browse/JASSIST-23">JASSIST-23</a>).
- Now ClassPool#toClass(CtClass, ClassLoader) should not be overridden. All
- subclasses of ClassPool must override toClass(CtClass, ClassLoader,
- ProtectionDomain).
-
- <li>CtClass#getAvailableAnnotations() etc. have been implemented.
-
- <li>A bug related to a way of dealing with a bridge method was fixed
- (<a href="http://jira.jboss.com/jira/browse/HIBERNATE-37">HIBERNATE-37</a>).
-
- <li>javassist.scopedpool package was added.
-</ul>
-
-<p>-version 3.2 on June 21, 2006
-
-<ul>
- <li>The behavior of CtBehavior#getParameterAnnotations() has been changed.
- It is now compatible to Java Reflection API
- (<a href="http://jira.jboss.com/jira/browse/JASSIST-19">JASSIST-19</a>).
-</ul>
-
-<p>- version 3.2.0.CR2 on May 9, 2006
-<ul>
- <li>A bug of replace(String,ExprEditor) in javassist.expr.Expr has been fixed.
- <li>Updated ProxyFactory getClassLoader to choose the javassit class loader
- when the proxy superclass has a null class loader (a jdk/endorsed class)
- (<a href='http://jira.jboss.com/jira/browse/JASSIST-18'>JASSIST-18</a>).
- <li>Updated the throws clause of the javassist.util.proxy.MethodHandler
- to be Throwable rather than Exception
- (<a href='http://jira.jboss.com/jira/browse/JASSIST-16'>JASSIST-16</a>).
-</ul>
-
-<p>- version 3.2.0.CR1 on March 18, 2006
-<ul>
- <li>Annotations enhancements to javassist.bytecode.MethodInfo.
- <li>Allow a ClassPool to override the "guess" at the classloader to use.
-</ul>
-
-<p>- version 3.1 on February 23, 2006
-
-<ul>
- <li>getFields(), getMethods(), and getConstructors() in CtClass
- were changed to return non-private memebers instead of only
- public members.
- <li>getEnclosingClass() in javassist.CtClass was renamed
- to getEnclosingMethod().
- <li>getModifiers() was extended to return Modifier.STATIC if the class
- is a static inner class.
- <li>The return type of CtClass.stopPruning() was changed from void
- to boolean.
- <li>toMethod() in javassist.CtConstructor has been implemented.
- <li>It includes new javassist.util.proxy package
- similar to Enhancer of CGLIB.
- <p>
- <li>The subpackages of Javassist were restructured.
- <ul>
- <li>javassist.tool package was renamed to javassist.tools.
- <li>HotSwapper was moved to javassist.util.
- <li>Several subpackages were moved to javassist.tools.
- <li>javassist.preproc package was elminated and the source was
- moved to the sample directory.
- </ul>
-</ul>
-
-<p>- version 3.1 RC2 on September 7, 2005
-
-<ul>
- <li>RC2 is released mainly for an administrative reason.
- <li>A few bugs have been fixed.
-</ul>
-
-<p>- version 3.1 RC1 on August 29, 2005
-
-<ul>
- <li>Better annotation supports. See <code>CtClass.getAnnotations()</code>
- <li>javassist.tool.HotSwapper was added.
- <li>javassist.ClassPool.importPackage() was added.
- <li>The compiler now accepts array initializers
- (only one dimensional arrays).
- <li>javassist.Dump was moved to javassist.tool.Dump.
- <li>Many bugs were fixed.
-</ul>
-
-<p>- version 3.0 on January 18, 2005
-
-<ul>
- <li>The compiler now supports synchronized statements and finally
- clauses.
- <li>You can now remove a method and a field.
-</ul>
-
-<p>- version 3.0 RC1 on September 13, 2004.
-
-<ul>
- <li>CtClass.toClass() has been reimplemented. The behavior has been
- changed.
- <li>javassist.expr.NewArray has been implemented. It enables modifying
- an expression for array creation.
- <li><code>.class</code> notation has been supported. The modified class
- file needs javassist.runtime.DotClass at runtime.
- <li>a bug in <code>CtClass.getMethods()</code> has been fixed.
- <li>The compiler supports a switch statement.
-</ul>
-
-<p>- version 3.0 beta on May 18th, 2004.
-
-<ul>
- <li>The ClassPool framework has been redesigned.
- <ul>
- <li>writeFile(), write(), ... in ClassPool have been moved to CtClass.
- <li>The design of javassist.Translator has been changed.
- </ul>
-
- <li>javassist.bytecode.annotation has been added for meta tags.
- <li>CtClass.makeNestedClass() has been added.
- <li>The methods declared in javassist.bytecode.InnerClassesAttribute
- have been renamed a bit.
- <li>Now local variables were made available in the source text passed to
- CtBehavior.insertBefore(), MethodCall.replace(), etc.
- <li>CtClass.main(), which prints the version number, has been added.
- <li>ClassPool.SimpleLoader has been public.
- <li>javassist.bytecode.DeprecatedAttribute has been added.
- <li>javassist.bytecode.LocalVariableAttribute has been added.
- <li>CtClass.getURL() and javassist.ClassPath.find() has been added.
- <li>CtBehavior.insertAt() has been added.
- <li>CtClass.detach() has been added.
- <li>CodeAttribute.computeMaxStack() has been added.
-</ul>
-
-<p>- version 2.6 in August, 2003.
-
-<ul>
- <li>The behavior of CtClass.setSuperclass() was changed.
- To obtain the previous behavior, call CtClass.replaceClassName().
- <li>CtConstructor.setBody() now works for class initializers.
- <li>CtNewMethod.delegator() now works for static methods.
- <li>javassist.expr.Expr.indexOfBytecode() has been added.
- <li>javassist.Loader has been modified so that getPackage() returns
- a package object.
- <li>Now, the compiler can correctly compile a try statement and an
- infinite while-loop.
-</ul>
-
-<p>- version 2.5.1 in May, 2003.
-<br>Simple changes for integration with JBoss AOP
-<ul>
- <li>Made ClassPool.get0 protected so that subclasses of ClassPool can call it.
- <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.
-</ul>
-
-<p>- version 2.5 in May, 2003.
-<br>From this version, Javassist is part of the JBoss project.
-<ul>
- <li>The license was changed from MPL to MPL/LGPL dual.
- <li>ClassPool.removeClassPath() and ClassPath.close() have been added.
- <li>ClassPool.makeClass(InputStream) has been added.
- <li>CtClass.makeClassInitializer() has been added.
- <li>javassist.expr.Expr has been changed to a public class.
- <li>javassist.expr.Handler has been added.
- <li>javassist.expr.MethodCall.isSuper() has been added.
- <li>CtMethod.isEmpty() and CtConstructor.isEmpty() have been added.
- <li>LoaderClassPath has been implemented.
-</ul>
-
-<p>- version 2.4 in February, 2003.
-<ul>
- <li>The compiler included in Javassist did not correctly work with
- interface methods. This bug was fixed.
- <li>Now javassist.bytecode.Bytecode allows more than 255 local
- variables in the same method.
- <li>javassist.expr.Instanceof and Cast have been added.
- <li>javassist.expr.{MethodCall,NewExpr,FieldAccess,Instanceof,Cast}.where()
- have been added. They return the caller-side method surrounding the
- expression.
- <li>javassist.expr.{MethodCall,NewExpr,FieldAccess,Instanceof,Cast}.mayThrow()
- have been added.
- <li>$class has been introduced.
- <li>The parameters to replaceFieldRead(), replaceFieldWrite(),
- and redirectFieldAccess() in javassist.CodeConverter are changed.
- <li>The compiler could not correctly handle a try-catch statement.
- This bug has been fixed.
-</ul>
-
-<p>- version 2.3 in December, 2002.
-<ul>
- <li>The tutorial has been revised a bit.
- <li>SerialVersionUID class was donated by Bob Lee. Thanks.
- <li>CtMethod.setBody() and CtConstructor.setBody() have been added.
- <li>javassist.reflect.ClassMetaobject.useContextClassLoader has been added.
- If true, the reflection package does not use Class.forName() but uses
- a context class loader specified by the user.
- <li>$sig and $type are now available.
- <li>Bugs in Bytecode.write() and read() have been fixed.
-</ul>
-
-<p>- version 2.2 in October, 2002.
-<ul>
- <li>The tutorial has been revised.
- <li>A new package <code>javassist.expr</code> has been added.
- This is replacement of classic <code>CodeConverter</code>.
- <li>javassist.ConstParameter was changed into
- javassist.CtMethod.ConstParameter.
- <li>javassist.FieldInitializer was renamed into
- javassist.CtField.Initializer.
- <li>A bug in javassist.bytecode.Bytecode.addInvokeinterface() has been
- fixed.
- <li>In javassist.bytecode.Bytecode, addGetfield(), addGetstatic(),
- addInvokespecial(), addInvokestatic(), addInvokevirtual(),
- and addInvokeinterface()
- have been modified to update the current statck depth.
-</ul>
-
-<p>- version 2.1 in July, 2002.
-<ul>
- <li>javassist.CtMember and javassist.CtBehavior have been added.
- <li>javassist.CtClass.toBytecode() has been added.
- <li>javassist.CtClass.toClass() and javassist.ClassPool.writeAsClass()
- has been added.
- <li>javassist.ByteArrayClassPath has been added.
- <li>javassist.bytecode.Mnemonic has been added.
- <li>Several bugs have been fixed.
-</ul>
-
-<p>- version 2.0 (major update) in November, 2001.
-<ul>
- <li>The javassist.bytecode package has been provided. It is a
- lower-level API for directly modifying a class file although
- the users must have detailed knowledge of the Java bytecode.
-
- <li>The mechanism for creating CtClass objects have been changed.
-
- <li>javassist.tool.Dump moves to the javassist package.
-</ul>
-
-<p>version 1.0 in July, 2001.
-<ul>
- <li>javassist.reflect.Metaobject and ClassMetaobject was changed.
- Now they throw the same exception that they receive from a
- base-level object.
-</ul>
-
-<p>- version 0.8
-<ul>
- <li>javassist.tool.Dump was added. It is a class file viewer.
-
- <li>javassist.FiledInitializer.byNewArray() was added. It is for
- initializing a field with an array object.
-
- <li>javassist.CodeConverter.redirectMethodCall() was added.
-
- <li>javassist.Run was added.
-</ul>
-
-<p>- version 0.7
-<ul>
- <li>javassit.Loader was largely modified. javassist.UserLoader was
- deleted. Instead, Codebase was renamed to ClassPath
- and UserClassPath was added. Now programmers who want to
- customize Loader must write a class implementing UserClassPath
- instead of UserLoader. This change is for sharing class search paths
- between Loader and CtClass.CtClass(String).
-
- <li>CtClass.addField(), addMethod(), addConstructor(), addWrapper() were
- also largely modified so that it receives CtNewMethod, CtNewConstructor,
- or CtNewField. The static methods for creating these objects were
- added to the API.
-
- <li>Constructors are now represented by CtConstructor objects.
- CtConstructor is a subclass of CtMethod.
-
- <li>CtClass.getUserAttribute() was removed. Use CtClass.getAttribute().
-
- <li>javassist.rmi.RmiLoader was added.
-
- <li>javassist.reflect.Metalevel._setMetaobject() was added. Now
- metaobjects can be replaced at runtime.
-</ul>
-
-<p>- version 0.6
-<ul>
- <li>Javassist was modified to correctly deal with array types appearing
- in signatures.
-
- <li>A bug crashed resulting bytecode if a class includes a private static
- filed. It has been fixed.
-
- <li>javassist.CtNewInterface was added.
-
- <li>javassist.Loader.recordClass() was renamed into makeClass().
-
- <li>javassist.UserLoader.loadClass() was changed to take the second
- parameter.
-</ul>
-
-<p>- version 0.5
-<ul>
- <li>a bug-fix version.
-</ul>
-
-<p>- version 0.4
-<ul>
- <li>Major update again. Many classes and methods were changed.
- Most of methods taking java.lang.Class have been changed to
- take javassist.CtClass.
-</ul>
-
-<p>- version 0.3
-<ul>
- <li>Major update. Many classes and methods were changed.
-</ul>
-
-<p>- version 0.2
-<ul>
- <li>Jar/zip files are supported.
-</ul>
-
-<p>-version 0.1 on April 16, 1999.
-<ul>
- <li>The first release.
-</ul>
-
-<p><br>
-
-<h2>Bug reports etc.</h2>
-
-<dl>
-<dt>Bug reports:
-<dd>Post your reports at <a href="http://www.jboss.org/jive.jsp">Forums</a>
-or directly send an email to:
-<br>
-<tt><a href="mailto:chiba at acm.org">chiba at acm.org</a></tt>
-or
-<tt><a href="mailto:chiba at is.titech.ac.jp">chiba at is.titech.ac.jp</a></tt>
-<br>
-
-<p><dt>The home page of Javassist:
-<dd>Visit <a href="http://www.javassist.org"><tt>www.javassist.org</tt></a>
-and <a href="http://www.jboss.org/index.html?module=html&op=userdisplay&id=developers/projects/javassist"><tt>www.jboss.org</tt></a>
-
-</dl>
-
-<p><br>
-
-<a name="copyright">
-<h2>Copyright notices</h2>
-
-<p>Javassist, a Java-bytecode translator toolkit.
-<br>Copyright (C) 1999-2009 Shigeru Chiba. All Rights Reserved.
-
-<p>The contents of this software, Javassist, are subject to
-the Mozilla Public License Version 1.1 (the "License");<br>
-you may not use this software except in compliance
-with the License. You may obtain a copy of the License at
-<br>http://www.mozilla.org/MPL/
-
-<p>Software distributed under the License is distributed on an "AS IS"
-basis, WITHOUT WARRANTY OF <br>ANY KIND, either express or implied.
-See the License for the specific language governing rights and
-<br>limitations under the License.
-
-<p>The Original Code is Javassist.
-
-<p>The Initial Developer of the Original Code is Shigeru Chiba.
-Portions created by the Initial Developer are<br>
-Copyright (C) 1999-2009 Shigeru Chiba. All Rights Reserved.
-<p>Contributor(s): ______________________________________.
-
-<p>Alternatively, the contents of this software may be used under the
-terms of the GNU Lesser General Public License Version 2.1 or later
-(the "LGPL"), in which case the provisions of the LGPL are applicable
-instead of those above. If you wish to allow use of your version of
-this software only under the terms of the LGPL, and not to allow others to
-use your version of this software under the terms of the MPL, indicate
-your decision by deleting the provisions above and replace them with
-the notice and other provisions required by the LGPL. If you do not
-delete the provisions above, a recipient may use your version of this
-software under the terms of either the MPL or the LGPL.
-
-<p>If you obtain this software as part of JBoss, the contents of this
-software may be used under only the terms of the LGPL. To use them
-under the MPL, you must obtain a separate package including only
-Javassist but not the other part of JBoss.
-
-<p>All the contributors to the original source tree must agree to
-the original license term described above.
-
-<p><br>
-
-<h2>Acknowledgments</h2>
-
-<p>The development of this software is sponsored in part by the PRESTO
-and CREST programs of <a href="http://www.jst.go.jp/">Japan
-Science and Technology Corporation</a>.
-
-<p>I'd like to thank Michiaki Tatsubori, Johan Cloetens,
-Philip Tomlinson, Alex Villazon, Pascal Rapicault, Dan HE, Eric Tanter,
-Michael Haupt, Toshiyuki Sasaki, Renaud Pawlak, Luc Bourlier,
-Eric Bui, Lewis Stiller, Susumu Yamazaki, Rodrigo Teruo Tomita,
-Marc Segura-Devillechaise, Jan Baudisch, Julien Blass, Yoshiki Sato,
-Fabian Crabus, Bo Norregaard Jorgensen, Bob Lee, Bill Burke,
-Remy Sanlaville, Muga Nishizawa, Alexey Loubyansky, Saori Oki,
-Andreas Salathe, Dante Torres estrada, S. Pam, Nuno Santos,
-Denis Taye, Colin Sampaleanu, Robert Bialek, Asato Shimotaki,
-Howard Lewis Ship, Richard Jones, Marjan Sterjev,
-Bruce McDonald, Mark Brennan, Vlad Skarzhevskyy,
-Brett Randall, Tsuyoshi Murakami, Nathan Meyers, Yoshiyuki Usui
-Yutaka Sunaga, Arjan van der Meer, Bruce Eckel, Guillaume Pothier,
-Kumar Matcha, Andreas Salathe, Renat Zubairov, Armin Haaf,
-Emmanuel Bernard
-and all other contributors for their contributions.
-
-<p><br>
-
-<hr>
-<a href="http://www.is.titech.ac.jp/~chiba">Shigeru Chiba</a>
-(Email: <tt>chiba at acm.org</tt>)
-<br>Dept. of Math. and Computing Sciences,
-<a href="http://www.titech.ac.jp">Tokyo Institute of Technology</a>
Copied: tags/rel_3_12_0_ga/Readme.html (from rev 531, trunk/Readme.html)
===================================================================
--- tags/rel_3_12_0_ga/Readme.html (rev 0)
+++ tags/rel_3_12_0_ga/Readme.html 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,786 @@
+<html>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <TITLE>Read Me First</TITLE>
+</HEAD>
+<body>
+
+<h1>Javassist version 3</h1>
+
+<h3>Copyright (C) 1999-2010 by Shigeru Chiba, All rights reserved.</h3>
+
+<p><br></p>
+
+<p>Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation
+simple. It is a class library for editing bytecodes in Java;
+it enables Java programs to define a new class at runtime and to
+modify a class file when the JVM loads it. Unlike other similar
+bytecode editors, Javassist provides two levels of API: source level
+and bytecode level. If the users use the source-level API, they can
+edit a class file without knowledge of the specifications of the Java
+bytecode. The whole API is designed with only the vocabulary of the
+Java language. You can even specify inserted bytecode in the form of
+source text; Javassist compiles it on the fly. On the other hand, the
+bytecode-level API allows the users to directly edit a class file as
+other editors.
+
+<p><br>
+
+<h2>Files</h2>
+
+<ul>
+<table>
+<tr>
+<td><li><tt><a href="License.html">License.html</a></tt></td>
+<td>License file
+(Also see the <a href="#copyright">copyright notices</a> below)</td>
+</tr>
+
+<tr>
+<td><li><tt><a href="tutorial/tutorial.html">tutorial/tutorial.html</a></tt></td>
+<td>Tutorial</td>
+</tr>
+
+<tr>
+<td><li><tt>./javassist.jar</tt></td>
+<td>The Javassist jar file (class files)</td>
+</tr>
+
+<tr>
+<td><li><tt>./src/main</tt></td>
+<td>The source files</td>
+</tr>
+
+<tr>
+<td><li><tt><a href="html/index.html">html/index.html</a></tt></td>
+<td>The top page of the Javassist API document.</td>
+</tr>
+
+<tr>
+<td><li><tt>./sample/</tt></td>
+<td>Sample programs</td>
+</tr>
+</table>
+</ul>
+
+<p><br>
+
+<h2>How to run sample programs</h2>
+
+<p>JDK 1.4 or later is needed.
+
+<h3>0. If you have Apache Ant</h3>
+
+<p>Run the sample-all task.
+Otherwise, follow the instructions below.
+
+<h3>1. Move to the directory where this Readme.html file is located.</h3>
+
+<p>In the following instructions, we assume that the javassist.jar
+file is included in the class path.
+For example, the javac and java commands must receive
+the following <code>classpath</code> option:
+
+<ul><pre>
+-classpath ".:javassist.jar"
+</pre></ul>
+
+<p>If the operating system is Windows, the path
+separator must be not <code>:</code> (colon) but
+<code>;</code> (semicolon). The java command can receive
+the <code>-cp</code> option
+as well as <code>-classpath</code>.
+
+<p>If you don't want to use the class-path option, you can make
+<code>javassist.jar</code> included in the <code>CLASSPATH</code>
+environment:
+
+<ul><pre>
+export CLASSPATH=.:javassist.jar
+</pre></ul>
+
+<p>or if the operating system is Windows:
+
+<ul><pre>
+set CLASSPATH=.;javassist.jar
+</pre></ul>
+
+
+<p>Otherwise, you can copy <tt>javassist.jar</tt> to the directory
+
+<ul><<i>java-home</i>><tt>/jre/lib/ext</tt>.</ul>
+
+<p><<i>java-home</i>> depends on the system. It is usually
+<tt>/usr/local/java</tt>, <tt>c:\j2sdk1.4\</tt>, etc.
+
+<h3>2. sample/Test.java</h3>
+
+<p> This is a very simple program using Javassist.
+
+<p> To run, type the commands:
+
+<ul><pre>
+% javac sample/Test.java
+% java sample.Test
+</pre></ul>
+
+<p> For more details, see <a type="text/plain" href="sample/Test.java">sample/Test.java</a>
+
+<h3>3. sample/reflect/*.java</h3>
+
+<p> This is the "verbose metaobject" example well known in reflective
+ programming. This program dynamically attaches a metaobject to
+ a Person object. The metaobject prints a message if a method
+ is called on the Person object.
+
+<p> To run, type the commands:
+
+<ul><pre>
+% javac sample/reflect/*.java
+% java javassist.tools.reflect.Loader sample.reflect.Main Joe
+</pre></ul>
+
+<p>Compare this result with that of the regular execution without reflection:
+
+<ul><pre>% java sample.reflect.Person Joe</pre></ul>
+
+<p> For more details, see <a type="text/plain" href="sample/reflect/Main.java">sample/reflect/Main.java</a>
+
+<p> Furthermore, the Person class can be statically modified so that
+ all the Person objects become reflective without sample.reflect.Main.
+ To do this, type the commands:
+
+<ul><pre>
+% java javassist.tools.reflect.Compiler sample.reflect.Person -m sample.reflect.VerboseMetaobj
+</pre></ul>
+
+<p> Then,
+<ul><pre>
+% java sample.reflect.Person Joe
+</pre></ul>
+
+<h3>4. sample/duplicate/*.java</h3>
+
+<p> This is another example of reflective programming.
+
+<p> To run, type the commands:
+
+<ul><pre>
+% javac sample/duplicate/*.java
+% java sample.duplicate.Main
+</pre></ul>
+
+<p>Compare this result with that of the regular execution without reflection:
+
+<ul><pre>% java sample.duplicate.Viewer</pre></ul>
+
+<p>For more details, see
+<a type="text/plain" href="sample/duplicate/Main.java">sample/duplicate/Main.java</a>
+
+<h3>5. sample/vector/*.java</h3>
+
+<p>This example shows the use of Javassit for producing a class representing
+a vector of a given type at compile time.
+
+<p> To run, type the commands:
+<ul><pre>
+% javac sample/vector/*.java
+% java sample.preproc.Compiler sample/vector/Test.j
+% javac sample/vector/Test.java
+% java sample.vector.Test
+</pre></ul>
+
+<p>Note: <code>javassist.jar</code> is unnecessary to compile and execute
+<code>sample/vector/Test.java</code>.
+
+For more details, see
+<a type="text/plain" href="sample/vector/Test.j">sample/vector/Test.j</a>
+and <a type="text/plain" href="sample/vector/VectorAssistant.java">sample/vector/VectorAssistant.java</a>
+
+<h3>6. sample/rmi/*.java</h3>
+
+<p> This demonstrates the javassist.rmi package.
+
+<p> To run, type the commands:
+<ul><pre>
+% javac sample/rmi/*.java
+% java sample.rmi.Counter 5001
+</pre></ul>
+
+<p> The second line starts a web server listening to port 5001.
+
+<p> Then, open <a href="sample/rmi/webdemo.html">sample/rmi/webdemo.html</a>
+with a web browser running
+ on the local host. (<tt>webdemo.html</tt> trys to fetch an applet from
+ <tt>http://localhost:5001/</tt>, which is the web server we started above.)
+
+<p> Otherwise, run sample.rmi.CountApplet as an application:
+
+<ul><pre>
+% java javassist.web.Viewer localhost 5001 sample.rmi.CountApplet
+</pre></ul>
+
+<h3>7. sample/evolve/*.java</h3>
+
+<p> This is a demonstration of the class evolution mechanism implemented
+ with Javassist. This mechanism enables a Java program to reload an
+ existing class file under some restriction.
+
+<p> To run, type the commands:
+<ul><pre>
+% javac sample/evolve/*.java
+% java sample.evolve.DemoLoader 5003
+</pre></ul>
+
+<p> The second line starts a class loader DemoLoader, which runs a web
+ server DemoServer listening to port 5003.
+
+<p> Then, open <a href="http://localhost:5003/demo.html">http://localhost:5003/demo.html</a> with a web browser running
+ on the local host.
+(Or, see <a href="sample/evolve/start.html">sample/evolve/start.html</a>.)
+
+<h3>8. sample/hotswap/*.java</h3>
+
+<p>This shows dynamic class reloading by the JPDA. It needs JDK 1.4 or later.
+To run, first type the following commands:
+
+<ul><pre>
+% cd sample/hotswap
+% javac *.java
+% cd logging
+% javac *.java
+% cd ..
+</pre></ul>
+
+<p>If your Java is 1.4, then type:
+
+<ul><pre>
+% java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 Test
+</pre></ul>
+
+<p>If you are using Java 5, then type:
+
+<ul><pre>
+% java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 Test
+</pre></ul>
+
+<p>Note that the class path must include <code>JAVA_HOME/lib/tools.jar</code>.
+
+<h2>Hints</h2>
+
+<p>To know the version number, type this command:
+
+<ul><pre>
+% java -jar javassist.jar
+</pre></ul>
+
+<p>Javassist provides a class file viewer for debugging. For more details,
+see javassist.Dump.
+
+<p><br>
+
+<h2>Changes</h2>
+
+<p>-version 3.12 on April 16, 2010
+
+<p>-version 3.11 on July 3, 2009
+<ul>
+ <li>JIRA JASSIST-67, 68, 74, 75, 76, 77, 81, 83, 84, 85, 86, 87 were fixed.
+ <li>Now javassist.bytecode.CodeIterator can insert a gap into
+ a large method body more than 32KB. (JIRA JASSIST-79, 80)
+</ul>
+
+<p>-version 3.10 on March 5, 2009
+
+<ul>
+ <li>JIRA JASSIST-69, 70, 71 were fixed.
+</ul>
+
+<p>-version 3.9 on October 9, 2008
+<ul>
+ <li>ClassPool.makeClassIfNew(InputStream) was implemented.
+ <li>CtNewMethod.wrapped(..) and CtNewConstructor.wrapped(..)
+ implicitly append a method like _added_m$0.
+ This method now has a synthetic attribute.
+ <li>JIRA JASSIST-66 has been fixed.
+</ul>
+
+<p>-version 3.8.1 on July 17, 2008
+<ul>
+ <li>CtClass.rebuildClassFile() has been added.
+ <li>A few bugs of javassist.bytecode.analysis have been fixed.
+ 3.8.0 could not correctly deal with one letter class name
+ such as I and J.
+</ul>
+
+<p>-version 3.8.0 on June 13, 2008
+<ul>
+ <li>javassist.bytecode.analysis was implemented.
+ <li>JASSIST-45, 47, 51, 54-57, 60, 62 were fixed.
+</ul>
+
+<p>-version 3.7.1 on March 10, 2008
+<ul>
+ <li>a bug of javassist.util.proxy has been fixed.
+</ul>
+
+<p>-version 3.7 on January 20, 2008
+<ul>
+ <li>Several minor bugs have been fixed.
+</ul>
+
+<p>-version 3.6.0 on September 13, 2007
+
+<p>-version 3.6.0.CR1 on July 27, 2007
+
+<ul>
+ <li>The stack map table introduced since Java 6 has been supported.
+ <li>CtClass#getDeclaredBehaviors() now returns a class initializer
+ as well as methods and constructors.
+ <li>The default status of automatic pruning was made off.
+ Instead of pruning, this version of Javassist compresses
+ the data structure of a class file after toBytecode() is called.
+ The compressed class file is automatically decompressed when needed.
+ This saves memory space better than pruning.
+ <li><a href="http://jira.jboss.com/jira/browse/JASSIST-33">JIRA JASSIST-33</a> has been fixed.
+</ul>
+
+<p>-version 3.5 on April 29, 2007
+<ul>
+ <li>Various minor updates.
+</ul>
+
+<p>-version 3.4 on November 17, 2006
+<ul>
+ <li>A bug in CodeConverter#replaceFieldRead() and CodeConverter#replaceFieldWrite()
+ was fixed. <a href="http://jira.jboss.com/jira/browse/JBAOP-284">JBAOP-284</a>.
+
+ <li>A synchronization bug and a performance bug in <code>javassist.util.proxy</code>
+ have been fixed
+ (<a href="http://jira.jboss.com/jira/browse/JASSIST-28">JASSIST-28</a>).
+ Now generated proxy classes are cached. To turn the caching off,
+ set <code>ProxyFactory.useCache</code> to <code>false</code>.
+</ul>
+
+<p>-version 3.3 on August 17, 2006
+<ul>
+ <li>CtClass#toClass() and ClassPool#toClass() were modified to accept a
+ <code>ProtectionDomain</code>
+ (<a href="http://jira.jboss.com/jira/browse/JASSIST-23">JASSIST-23</a>).
+ Now ClassPool#toClass(CtClass, ClassLoader) should not be overridden. All
+ subclasses of ClassPool must override toClass(CtClass, ClassLoader,
+ ProtectionDomain).
+
+ <li>CtClass#getAvailableAnnotations() etc. have been implemented.
+
+ <li>A bug related to a way of dealing with a bridge method was fixed
+ (<a href="http://jira.jboss.com/jira/browse/HIBERNATE-37">HIBERNATE-37</a>).
+
+ <li>javassist.scopedpool package was added.
+</ul>
+
+<p>-version 3.2 on June 21, 2006
+
+<ul>
+ <li>The behavior of CtBehavior#getParameterAnnotations() has been changed.
+ It is now compatible to Java Reflection API
+ (<a href="http://jira.jboss.com/jira/browse/JASSIST-19">JASSIST-19</a>).
+</ul>
+
+<p>- version 3.2.0.CR2 on May 9, 2006
+<ul>
+ <li>A bug of replace(String,ExprEditor) in javassist.expr.Expr has been fixed.
+ <li>Updated ProxyFactory getClassLoader to choose the javassit class loader
+ when the proxy superclass has a null class loader (a jdk/endorsed class)
+ (<a href='http://jira.jboss.com/jira/browse/JASSIST-18'>JASSIST-18</a>).
+ <li>Updated the throws clause of the javassist.util.proxy.MethodHandler
+ to be Throwable rather than Exception
+ (<a href='http://jira.jboss.com/jira/browse/JASSIST-16'>JASSIST-16</a>).
+</ul>
+
+<p>- version 3.2.0.CR1 on March 18, 2006
+<ul>
+ <li>Annotations enhancements to javassist.bytecode.MethodInfo.
+ <li>Allow a ClassPool to override the "guess" at the classloader to use.
+</ul>
+
+<p>- version 3.1 on February 23, 2006
+
+<ul>
+ <li>getFields(), getMethods(), and getConstructors() in CtClass
+ were changed to return non-private memebers instead of only
+ public members.
+ <li>getEnclosingClass() in javassist.CtClass was renamed
+ to getEnclosingMethod().
+ <li>getModifiers() was extended to return Modifier.STATIC if the class
+ is a static inner class.
+ <li>The return type of CtClass.stopPruning() was changed from void
+ to boolean.
+ <li>toMethod() in javassist.CtConstructor has been implemented.
+ <li>It includes new javassist.util.proxy package
+ similar to Enhancer of CGLIB.
+ <p>
+ <li>The subpackages of Javassist were restructured.
+ <ul>
+ <li>javassist.tool package was renamed to javassist.tools.
+ <li>HotSwapper was moved to javassist.util.
+ <li>Several subpackages were moved to javassist.tools.
+ <li>javassist.preproc package was elminated and the source was
+ moved to the sample directory.
+ </ul>
+</ul>
+
+<p>- version 3.1 RC2 on September 7, 2005
+
+<ul>
+ <li>RC2 is released mainly for an administrative reason.
+ <li>A few bugs have been fixed.
+</ul>
+
+<p>- version 3.1 RC1 on August 29, 2005
+
+<ul>
+ <li>Better annotation supports. See <code>CtClass.getAnnotations()</code>
+ <li>javassist.tool.HotSwapper was added.
+ <li>javassist.ClassPool.importPackage() was added.
+ <li>The compiler now accepts array initializers
+ (only one dimensional arrays).
+ <li>javassist.Dump was moved to javassist.tool.Dump.
+ <li>Many bugs were fixed.
+</ul>
+
+<p>- version 3.0 on January 18, 2005
+
+<ul>
+ <li>The compiler now supports synchronized statements and finally
+ clauses.
+ <li>You can now remove a method and a field.
+</ul>
+
+<p>- version 3.0 RC1 on September 13, 2004.
+
+<ul>
+ <li>CtClass.toClass() has been reimplemented. The behavior has been
+ changed.
+ <li>javassist.expr.NewArray has been implemented. It enables modifying
+ an expression for array creation.
+ <li><code>.class</code> notation has been supported. The modified class
+ file needs javassist.runtime.DotClass at runtime.
+ <li>a bug in <code>CtClass.getMethods()</code> has been fixed.
+ <li>The compiler supports a switch statement.
+</ul>
+
+<p>- version 3.0 beta on May 18th, 2004.
+
+<ul>
+ <li>The ClassPool framework has been redesigned.
+ <ul>
+ <li>writeFile(), write(), ... in ClassPool have been moved to CtClass.
+ <li>The design of javassist.Translator has been changed.
+ </ul>
+
+ <li>javassist.bytecode.annotation has been added for meta tags.
+ <li>CtClass.makeNestedClass() has been added.
+ <li>The methods declared in javassist.bytecode.InnerClassesAttribute
+ have been renamed a bit.
+ <li>Now local variables were made available in the source text passed to
+ CtBehavior.insertBefore(), MethodCall.replace(), etc.
+ <li>CtClass.main(), which prints the version number, has been added.
+ <li>ClassPool.SimpleLoader has been public.
+ <li>javassist.bytecode.DeprecatedAttribute has been added.
+ <li>javassist.bytecode.LocalVariableAttribute has been added.
+ <li>CtClass.getURL() and javassist.ClassPath.find() has been added.
+ <li>CtBehavior.insertAt() has been added.
+ <li>CtClass.detach() has been added.
+ <li>CodeAttribute.computeMaxStack() has been added.
+</ul>
+
+<p>- version 2.6 in August, 2003.
+
+<ul>
+ <li>The behavior of CtClass.setSuperclass() was changed.
+ To obtain the previous behavior, call CtClass.replaceClassName().
+ <li>CtConstructor.setBody() now works for class initializers.
+ <li>CtNewMethod.delegator() now works for static methods.
+ <li>javassist.expr.Expr.indexOfBytecode() has been added.
+ <li>javassist.Loader has been modified so that getPackage() returns
+ a package object.
+ <li>Now, the compiler can correctly compile a try statement and an
+ infinite while-loop.
+</ul>
+
+<p>- version 2.5.1 in May, 2003.
+<br>Simple changes for integration with JBoss AOP
+<ul>
+ <li>Made ClassPool.get0 protected so that subclasses of ClassPool can call it.
+ <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.
+</ul>
+
+<p>- version 2.5 in May, 2003.
+<br>From this version, Javassist is part of the JBoss project.
+<ul>
+ <li>The license was changed from MPL to MPL/LGPL dual.
+ <li>ClassPool.removeClassPath() and ClassPath.close() have been added.
+ <li>ClassPool.makeClass(InputStream) has been added.
+ <li>CtClass.makeClassInitializer() has been added.
+ <li>javassist.expr.Expr has been changed to a public class.
+ <li>javassist.expr.Handler has been added.
+ <li>javassist.expr.MethodCall.isSuper() has been added.
+ <li>CtMethod.isEmpty() and CtConstructor.isEmpty() have been added.
+ <li>LoaderClassPath has been implemented.
+</ul>
+
+<p>- version 2.4 in February, 2003.
+<ul>
+ <li>The compiler included in Javassist did not correctly work with
+ interface methods. This bug was fixed.
+ <li>Now javassist.bytecode.Bytecode allows more than 255 local
+ variables in the same method.
+ <li>javassist.expr.Instanceof and Cast have been added.
+ <li>javassist.expr.{MethodCall,NewExpr,FieldAccess,Instanceof,Cast}.where()
+ have been added. They return the caller-side method surrounding the
+ expression.
+ <li>javassist.expr.{MethodCall,NewExpr,FieldAccess,Instanceof,Cast}.mayThrow()
+ have been added.
+ <li>$class has been introduced.
+ <li>The parameters to replaceFieldRead(), replaceFieldWrite(),
+ and redirectFieldAccess() in javassist.CodeConverter are changed.
+ <li>The compiler could not correctly handle a try-catch statement.
+ This bug has been fixed.
+</ul>
+
+<p>- version 2.3 in December, 2002.
+<ul>
+ <li>The tutorial has been revised a bit.
+ <li>SerialVersionUID class was donated by Bob Lee. Thanks.
+ <li>CtMethod.setBody() and CtConstructor.setBody() have been added.
+ <li>javassist.reflect.ClassMetaobject.useContextClassLoader has been added.
+ If true, the reflection package does not use Class.forName() but uses
+ a context class loader specified by the user.
+ <li>$sig and $type are now available.
+ <li>Bugs in Bytecode.write() and read() have been fixed.
+</ul>
+
+<p>- version 2.2 in October, 2002.
+<ul>
+ <li>The tutorial has been revised.
+ <li>A new package <code>javassist.expr</code> has been added.
+ This is replacement of classic <code>CodeConverter</code>.
+ <li>javassist.ConstParameter was changed into
+ javassist.CtMethod.ConstParameter.
+ <li>javassist.FieldInitializer was renamed into
+ javassist.CtField.Initializer.
+ <li>A bug in javassist.bytecode.Bytecode.addInvokeinterface() has been
+ fixed.
+ <li>In javassist.bytecode.Bytecode, addGetfield(), addGetstatic(),
+ addInvokespecial(), addInvokestatic(), addInvokevirtual(),
+ and addInvokeinterface()
+ have been modified to update the current statck depth.
+</ul>
+
+<p>- version 2.1 in July, 2002.
+<ul>
+ <li>javassist.CtMember and javassist.CtBehavior have been added.
+ <li>javassist.CtClass.toBytecode() has been added.
+ <li>javassist.CtClass.toClass() and javassist.ClassPool.writeAsClass()
+ has been added.
+ <li>javassist.ByteArrayClassPath has been added.
+ <li>javassist.bytecode.Mnemonic has been added.
+ <li>Several bugs have been fixed.
+</ul>
+
+<p>- version 2.0 (major update) in November, 2001.
+<ul>
+ <li>The javassist.bytecode package has been provided. It is a
+ lower-level API for directly modifying a class file although
+ the users must have detailed knowledge of the Java bytecode.
+
+ <li>The mechanism for creating CtClass objects have been changed.
+
+ <li>javassist.tool.Dump moves to the javassist package.
+</ul>
+
+<p>version 1.0 in July, 2001.
+<ul>
+ <li>javassist.reflect.Metaobject and ClassMetaobject was changed.
+ Now they throw the same exception that they receive from a
+ base-level object.
+</ul>
+
+<p>- version 0.8
+<ul>
+ <li>javassist.tool.Dump was added. It is a class file viewer.
+
+ <li>javassist.FiledInitializer.byNewArray() was added. It is for
+ initializing a field with an array object.
+
+ <li>javassist.CodeConverter.redirectMethodCall() was added.
+
+ <li>javassist.Run was added.
+</ul>
+
+<p>- version 0.7
+<ul>
+ <li>javassit.Loader was largely modified. javassist.UserLoader was
+ deleted. Instead, Codebase was renamed to ClassPath
+ and UserClassPath was added. Now programmers who want to
+ customize Loader must write a class implementing UserClassPath
+ instead of UserLoader. This change is for sharing class search paths
+ between Loader and CtClass.CtClass(String).
+
+ <li>CtClass.addField(), addMethod(), addConstructor(), addWrapper() were
+ also largely modified so that it receives CtNewMethod, CtNewConstructor,
+ or CtNewField. The static methods for creating these objects were
+ added to the API.
+
+ <li>Constructors are now represented by CtConstructor objects.
+ CtConstructor is a subclass of CtMethod.
+
+ <li>CtClass.getUserAttribute() was removed. Use CtClass.getAttribute().
+
+ <li>javassist.rmi.RmiLoader was added.
+
+ <li>javassist.reflect.Metalevel._setMetaobject() was added. Now
+ metaobjects can be replaced at runtime.
+</ul>
+
+<p>- version 0.6
+<ul>
+ <li>Javassist was modified to correctly deal with array types appearing
+ in signatures.
+
+ <li>A bug crashed resulting bytecode if a class includes a private static
+ filed. It has been fixed.
+
+ <li>javassist.CtNewInterface was added.
+
+ <li>javassist.Loader.recordClass() was renamed into makeClass().
+
+ <li>javassist.UserLoader.loadClass() was changed to take the second
+ parameter.
+</ul>
+
+<p>- version 0.5
+<ul>
+ <li>a bug-fix version.
+</ul>
+
+<p>- version 0.4
+<ul>
+ <li>Major update again. Many classes and methods were changed.
+ Most of methods taking java.lang.Class have been changed to
+ take javassist.CtClass.
+</ul>
+
+<p>- version 0.3
+<ul>
+ <li>Major update. Many classes and methods were changed.
+</ul>
+
+<p>- version 0.2
+<ul>
+ <li>Jar/zip files are supported.
+</ul>
+
+<p>-version 0.1 on April 16, 1999.
+<ul>
+ <li>The first release.
+</ul>
+
+<p><br>
+
+<h2>Bug reports etc.</h2>
+
+<dl>
+<dt>Bug reports:
+<dd>Post your reports at <a href="http://www.jboss.org/jive.jsp">Forums</a>
+or directly send an email to:
+<br>
+<tt><a href="mailto:chiba at acm.org">chiba at acm.org</a></tt>
+or
+<tt><a href="mailto:chiba at is.titech.ac.jp">chiba at is.titech.ac.jp</a></tt>
+<br>
+
+<p><dt>The home page of Javassist:
+<dd>Visit <a href="http://www.javassist.org"><tt>www.javassist.org</tt></a>
+and <a href="http://www.jboss.org/index.html?module=html&op=userdisplay&id=developers/projects/javassist"><tt>www.jboss.org</tt></a>
+
+</dl>
+
+<p><br>
+
+<a name="copyright">
+<h2>Copyright notices</h2>
+
+<p>Javassist, a Java-bytecode translator toolkit.
+<br>Copyright (C) 1999-2010 Shigeru Chiba. All Rights Reserved.
+
+<p>The contents of this software, Javassist, are subject to
+the Mozilla Public License Version 1.1 (the "License");<br>
+you may not use this software except in compliance
+with the License. You may obtain a copy of the License at
+<br>http://www.mozilla.org/MPL/
+
+<p>Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF <br>ANY KIND, either express or implied.
+See the License for the specific language governing rights and
+<br>limitations under the License.
+
+<p>The Original Code is Javassist.
+
+<p>The Initial Developer of the Original Code is Shigeru Chiba.
+Portions created by the Initial Developer are<br>
+Copyright (C) 1999-2010 Shigeru Chiba. All Rights Reserved.
+<p>Contributor(s): ______________________________________.
+
+<p>Alternatively, the contents of this software may be used under the
+terms of the GNU Lesser General Public License Version 2.1 or later
+(the "LGPL"), in which case the provisions of the LGPL are applicable
+instead of those above. If you wish to allow use of your version of
+this software only under the terms of the LGPL, and not to allow others to
+use your version of this software under the terms of the MPL, indicate
+your decision by deleting the provisions above and replace them with
+the notice and other provisions required by the LGPL. If you do not
+delete the provisions above, a recipient may use your version of this
+software under the terms of either the MPL or the LGPL.
+
+<p>If you obtain this software as part of JBoss, the contents of this
+software may be used under only the terms of the LGPL. To use them
+under the MPL, you must obtain a separate package including only
+Javassist but not the other part of JBoss.
+
+<p>All the contributors to the original source tree must agree to
+the original license term described above.
+
+<p><br>
+
+<h2>Acknowledgments</h2>
+
+<p>The development of this software is sponsored in part by the PRESTO
+and CREST programs of <a href="http://www.jst.go.jp/">Japan
+Science and Technology Corporation</a>.
+
+<p>I'd like to thank Michiaki Tatsubori, Johan Cloetens,
+Philip Tomlinson, Alex Villazon, Pascal Rapicault, Dan HE, Eric Tanter,
+Michael Haupt, Toshiyuki Sasaki, Renaud Pawlak, Luc Bourlier,
+Eric Bui, Lewis Stiller, Susumu Yamazaki, Rodrigo Teruo Tomita,
+Marc Segura-Devillechaise, Jan Baudisch, Julien Blass, Yoshiki Sato,
+Fabian Crabus, Bo Norregaard Jorgensen, Bob Lee, Bill Burke,
+Remy Sanlaville, Muga Nishizawa, Alexey Loubyansky, Saori Oki,
+Andreas Salathe, Dante Torres estrada, S. Pam, Nuno Santos,
+Denis Taye, Colin Sampaleanu, Robert Bialek, Asato Shimotaki,
+Howard Lewis Ship, Richard Jones, Marjan Sterjev,
+Bruce McDonald, Mark Brennan, Vlad Skarzhevskyy,
+Brett Randall, Tsuyoshi Murakami, Nathan Meyers, Yoshiyuki Usui
+Yutaka Sunaga, Arjan van der Meer, Bruce Eckel, Guillaume Pothier,
+Kumar Matcha, Andreas Salathe, Renat Zubairov, Armin Haaf,
+Emmanuel Bernard
+and all other contributors for their contributions.
+
+<p><br>
+
+<hr>
+<a href="http://www.is.titech.ac.jp/~chiba">Shigeru Chiba</a>
+(Email: <tt>chiba at acm.org</tt>)
+<br>Dept. of Math. and Computing Sciences,
+<a href="http://www.titech.ac.jp">Tokyo Institute of Technology</a>
Deleted: tags/rel_3_12_0_ga/build.xml
===================================================================
--- trunk/build.xml 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/build.xml 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,298 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- =================================================================== -->
-<!-- JBoss build file -->
-<!-- =================================================================== -->
-
-<project name="javassist" default="jar" basedir=".">
-
- <property name="dist-version" value="javassist-3.12.GA"/>
-
- <property environment="env"/>
- <property name="target.jar" value="javassist.jar"/>
- <property name="target-src.jar" value="javassist-src.jar"/>
- <property name="lib.dir" value="${basedir}/lib"/>
- <property name="src.dir" value="${basedir}/src/main"/>
- <property name="build.dir" value="${basedir}/build"/>
- <property name="build.classes.dir" value="${build.dir}/classes"/>
- <property name="test.src.dir" value="${basedir}/src/test"/>
- <property name="test.build.dir" value="${basedir}/build/test-classes"/>
- <property name="test.reports.dir" value = "${basedir}/build/test-output"/>
-
- <property name="run.dir" value="${build.classes.dir}"/>
-
- <!-- Build classpath -->
- <path id="classpath">
- <pathelement location="${build.classes.dir}"/>
- </path>
-
- <property name="build.classpath" refid="classpath"/>
-
- <path id="test.compile.classpath">
- <pathelement location="${build.classes.dir}"/>
- <pathelement location="${lib.dir}/junit.jar"/>
- </path>
-
- <property name="test.compile.classpath" refid="test.compile.classpath"/>
-
- <path id="test.classpath">
- <pathelement location="${test.build.dir}"/>
- <pathelement location="${lib.dir}/junit.jar"/>
- <pathelement location="${build.classes.dir}"/>
- </path>
-
- <property name="test.classpath" refid="test.classpath"/>
-
- <!-- =================================================================== -->
- <!-- Prepares the build directory -->
- <!-- =================================================================== -->
- <target name="prepare" >
- <mkdir dir="${build.dir}"/>
- <mkdir dir="${build.classes.dir}"/>
- <mkdir dir="${test.build.dir}"/>
- <mkdir dir="${test.reports.dir}"/>
- </target>
-
- <!-- =================================================================== -->
- <!-- Compiles the source code -->
- <!-- =================================================================== -->
- <target name="compile" depends="prepare">
- <javac srcdir="${src.dir}"
- destdir="${build.classes.dir}"
- debug="on"
- deprecation="on"
- optimize="off"
- includes="**">
- <classpath refid="classpath"/>
- </javac>
- </target>
-
- <target name="compile14" depends="prepare">
- <javac srcdir="${src.dir}"
- destdir="${build.classes.dir}"
- debug="on"
- deprecation="on"
- source="1.4"
- target="1.4"
- optimize="off"
- includes="**">
- <classpath refid="classpath"/>
- </javac>
- </target>
-
- <target name="test-compile" depends="compile">
- <javac srcdir="${test.src.dir}"
- destdir="${test.build.dir}"
- debug="on"
- deprecation="on"
- optimize="off"
- includes="**">
- <classpath refid="test.compile.classpath"/>
- </javac>
- </target>
-
- <target name="test" depends="test-compile">
- <junit fork="true" printsummary="true">
- <classpath refid="test.classpath"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest todir="${test.reports.dir}">
- <fileset dir="${test.build.dir}">
- <include name="**/*Test.*"/>
- </fileset>
- </batchtest>
- </junit>
- </target>
-
- <target name="sample" depends="compile">
- <javac srcdir="${basedir}"
- destdir="${build.classes.dir}"
- debug="on"
- deprecation="on"
- optimize="off"
- includes="sample/**"
- excludes="sample/hotswap/**,sample/evolve/sample/**">
- <classpath refid="classpath"/>
- </javac>
-
- <copy file="sample/vector/Test.j"
- todir="${build.classes.dir}/sample/vector"/>
-
- <javac srcdir="${basedir}/sample/evolve"
- destdir="${build.classes.dir}/sample/evolve/"
- debug="on"
- deprecation="on"
- optimize="off"
- includes="sample/**">
- <classpath refid="classpath"/>
- </javac>
- <copy todir="${build.classes.dir}/sample/evolve">
- <fileset dir="sample/evolve"/>
- </copy>
- <copy file="${build.classes.dir}/sample/evolve/WebPage.class"
- tofile="${build.classes.dir}/sample/evolve/WebPage.class.0"/>
- <copy file="${build.classes.dir}/sample/evolve/sample/evolve/WebPage.class"
- tofile="${build.classes.dir}/sample/evolve/WebPage.class.1"/>
-
- <javac srcdir="${basedir}/sample/hotswap"
- destdir="${build.classes.dir}"
- debug="on"
- deprecation="on"
- optimize="off"
- includes="*">
- <classpath refid="classpath"/>
- </javac>
- <mkdir dir="${build.classes.dir}/logging"/>
- <javac srcdir="${basedir}/sample/hotswap/logging"
- destdir="${build.classes.dir}/logging"
- debug="on"
- deprecation="on"
- optimize="off"
- includes="*">
- <classpath refid="classpath"/>
- </javac>
- <echo>To run the sample programs without ant, change the current directory
-to ${build.classes.dir}.</echo>
- </target>
-
- <target name="jar" depends="compile14">
- <jar jarfile="${target.jar}" manifest="${src.dir}/META-INF/MANIFEST.MF">
- <fileset dir="${build.classes.dir}">
- <include name="**/*.class"/>
- </fileset>
- </jar>
- <jar jarfile="${target-src.jar}" manifest="${src.dir}/META-INF/MANIFEST.MF">
- <fileset dir="${src.dir}">
- <include name="javassist/**"/>
- </fileset>
- </jar>
- </target>
-
- <target name="javadocs">
- <mkdir dir="html"/>
- <javadoc
- Locale="en_US"
- packagenames="javassist.*"
- excludepackagenames="javassist.compiler.*,javassist.convert.*,javassist.scopedpool.*,javassist.bytecode.stackmap.*"
- sourcepath="src/main"
- defaultexcludes="yes"
- destdir="html"
- author="true"
- version="true"
- use="true"
- public="true"
- nohelp="true"
- windowtitle="Javassist API">
- <doctitle><![CDATA[<h1>Javassist</h1>]]></doctitle>
- <bottom><![CDATA[<i>Javassist, a Java-bytecode translator toolkit.<br>
-Copyright (C) 1999-2009 Shigeru Chiba. All Rights Reserved.</i>]]></bottom>
- </javadoc>
- </target>
-
- <target name="dist" depends="jar,javadocs">
- <delete file="${dist-version}.zip"/>
- <zip zipfile="${dist-version}.zip">
- <zipfileset dir="${basedir}" prefix="${dist-version}">
- <include name="html/**"/>
- <include name="sample/**"/>
- <include name="src/main/**"/>
- <include name="tutorial/**"/>
- <include name="*.html"/>
- <include name="*.xml"/>
- <include name="${target.jar}"/>
- </zipfileset>
- </zip>
- </target>
-
- <target name="clean">
- <delete dir="build"/>
- <delete dir="html"/>
- <delete file="${target.jar}"/>
- <delete file="${dist-version}.zip"/>
- </target>
-
- <!-- =================================================================== -->
- <!-- Run samples -->
- <!-- =================================================================== -->
-
- <target name = "sample-all"
- depends="sample-test,sample-reflect,sample-duplicate,sample-vector">
- <echo>** please run sample-rmi, sample-evolve, and</echo>
- <echo> sample-hotswap (or -hotswap5) separately **</echo>
- </target>
-
- <target name = "sample-test" depends="sample" >
- <java fork="true" dir="${run.dir}" classname="sample.Test">
- <classpath refid="classpath"/>
- </java>
- </target>
-
- <target name = "sample-reflect" depends="sample" >
- <java fork="true" dir="${run.dir}" classname="javassist.tools.reflect.Loader">
- <classpath refid="classpath"/>
- <arg line="sample.reflect.Main Joe" />
- </java>
- </target>
-
- <target name = "sample-duplicate" depends="sample" >
- <echo>run sample.duplicate.Viewer without reflection</echo>
- <java fork="true" dir="${run.dir}" classname="sample.duplicate.Viewer">
- <classpath refid="classpath"/>
- </java>
- <echo>run sample.duplicate.Viewer with reflection</echo>
- <java fork="true" dir="${run.dir}" classname="sample.duplicate.Main">
- <classpath refid="classpath"/>
- </java>
- </target>
-
- <target name = "sample-vector" depends="sample" >
- <echo>sample.preproc.Compiler sample/vector/Test.j</echo>
- <java fork="true" dir="${run.dir}" classname="sample.preproc.Compiler">
- <classpath refid="classpath"/>
- <arg line="sample/vector/Test.j"/>
- </java>
- <echo>javac sample/vector/Test.java</echo>
- <javac srcdir="${build.classes.dir}"
- destdir="${build.classes.dir}"
- includes="sample/vector/Test.java">
- <classpath refid="classpath"/>
- </javac>
- <java fork="true" dir="${run.dir}" classname="sample.vector.Test" />
- </target>
-
- <target name = "sample-rmi" depends="sample" >
- <echo>** Please open sample/rmi/webdemo.html with your browser **</echo>
- <java fork="true" dir="${run.dir}" classname="sample.rmi.Counter">
- <classpath refid="classpath"/>
- <arg value="5001" />
- </java>
- </target>
-
- <target name = "sample-evolve" depends="sample" >
- <echo>** Please open http://localhost:5003/demo.html with your browser **</echo>
- <java fork="true" dir="${run.dir}" classname="sample.evolve.DemoLoader">
- <classpath refid="classpath"/>
- <arg value="5003" />
- </java>
- </target>
-
- <!-- for JDK 1.4 -->
- <target name = "sample-hotswap" depends="sample">
- <echo>** JAVA_HOME/lib/tools.jar must be included in CLASS_PATH</echo>
- <echo>** for JDK 1.4</echo>
- <java fork="true" dir="${run.dir}" classname="Test">
- <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000" />
- <classpath refid="classpath"/>
- </java>
- </target>
-
- <!-- for Java 5 -->
- <target name = "sample-hotswap5" depends="sample">
- <echo>** JAVA_HOME/lib/tools.jar must be included in CLASS_PATH</echo>
- <echo>** for JDK 1.5 or later</echo>
- <java fork="true" dir="${run.dir}" classname="Test">
- <jvmarg line="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000" />
- <classpath refid="classpath"/>
- </java>
- </target>
-</project>
Copied: tags/rel_3_12_0_ga/build.xml (from rev 531, trunk/build.xml)
===================================================================
--- tags/rel_3_12_0_ga/build.xml (rev 0)
+++ tags/rel_3_12_0_ga/build.xml 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,298 @@
+<?xml version="1.0"?>
+
+<!-- =================================================================== -->
+<!-- JBoss build file -->
+<!-- =================================================================== -->
+
+<project name="javassist" default="jar" basedir=".">
+
+ <property name="dist-version" value="javassist-3.12.GA"/>
+
+ <property environment="env"/>
+ <property name="target.jar" value="javassist.jar"/>
+ <property name="target-src.jar" value="javassist-src.jar"/>
+ <property name="lib.dir" value="${basedir}/lib"/>
+ <property name="src.dir" value="${basedir}/src/main"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="test.src.dir" value="${basedir}/src/test"/>
+ <property name="test.build.dir" value="${basedir}/build/test-classes"/>
+ <property name="test.reports.dir" value = "${basedir}/build/test-output"/>
+
+ <property name="run.dir" value="${build.classes.dir}"/>
+
+ <!-- Build classpath -->
+ <path id="classpath">
+ <pathelement location="${build.classes.dir}"/>
+ </path>
+
+ <property name="build.classpath" refid="classpath"/>
+
+ <path id="test.compile.classpath">
+ <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${lib.dir}/junit.jar"/>
+ </path>
+
+ <property name="test.compile.classpath" refid="test.compile.classpath"/>
+
+ <path id="test.classpath">
+ <pathelement location="${test.build.dir}"/>
+ <pathelement location="${lib.dir}/junit.jar"/>
+ <pathelement location="${build.classes.dir}"/>
+ </path>
+
+ <property name="test.classpath" refid="test.classpath"/>
+
+ <!-- =================================================================== -->
+ <!-- Prepares the build directory -->
+ <!-- =================================================================== -->
+ <target name="prepare" >
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.classes.dir}"/>
+ <mkdir dir="${test.build.dir}"/>
+ <mkdir dir="${test.reports.dir}"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Compiles the source code -->
+ <!-- =================================================================== -->
+ <target name="compile" depends="prepare">
+ <javac srcdir="${src.dir}"
+ destdir="${build.classes.dir}"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ includes="**">
+ <classpath refid="classpath"/>
+ </javac>
+ </target>
+
+ <target name="compile14" depends="prepare">
+ <javac srcdir="${src.dir}"
+ destdir="${build.classes.dir}"
+ debug="on"
+ deprecation="on"
+ source="1.4"
+ target="1.4"
+ optimize="off"
+ includes="**">
+ <classpath refid="classpath"/>
+ </javac>
+ </target>
+
+ <target name="test-compile" depends="compile">
+ <javac srcdir="${test.src.dir}"
+ destdir="${test.build.dir}"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ includes="**">
+ <classpath refid="test.compile.classpath"/>
+ </javac>
+ </target>
+
+ <target name="test" depends="test-compile">
+ <junit fork="true" printsummary="true">
+ <classpath refid="test.classpath"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <batchtest todir="${test.reports.dir}">
+ <fileset dir="${test.build.dir}">
+ <include name="**/*Test.*"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="sample" depends="compile">
+ <javac srcdir="${basedir}"
+ destdir="${build.classes.dir}"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ includes="sample/**"
+ excludes="sample/hotswap/**,sample/evolve/sample/**">
+ <classpath refid="classpath"/>
+ </javac>
+
+ <copy file="sample/vector/Test.j"
+ todir="${build.classes.dir}/sample/vector"/>
+
+ <javac srcdir="${basedir}/sample/evolve"
+ destdir="${build.classes.dir}/sample/evolve/"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ includes="sample/**">
+ <classpath refid="classpath"/>
+ </javac>
+ <copy todir="${build.classes.dir}/sample/evolve">
+ <fileset dir="sample/evolve"/>
+ </copy>
+ <copy file="${build.classes.dir}/sample/evolve/WebPage.class"
+ tofile="${build.classes.dir}/sample/evolve/WebPage.class.0"/>
+ <copy file="${build.classes.dir}/sample/evolve/sample/evolve/WebPage.class"
+ tofile="${build.classes.dir}/sample/evolve/WebPage.class.1"/>
+
+ <javac srcdir="${basedir}/sample/hotswap"
+ destdir="${build.classes.dir}"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ includes="*">
+ <classpath refid="classpath"/>
+ </javac>
+ <mkdir dir="${build.classes.dir}/logging"/>
+ <javac srcdir="${basedir}/sample/hotswap/logging"
+ destdir="${build.classes.dir}/logging"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ includes="*">
+ <classpath refid="classpath"/>
+ </javac>
+ <echo>To run the sample programs without ant, change the current directory
+to ${build.classes.dir}.</echo>
+ </target>
+
+ <target name="jar" depends="compile14">
+ <jar jarfile="${target.jar}" manifest="${src.dir}/META-INF/MANIFEST.MF">
+ <fileset dir="${build.classes.dir}">
+ <include name="**/*.class"/>
+ </fileset>
+ </jar>
+ <jar jarfile="${target-src.jar}" manifest="${src.dir}/META-INF/MANIFEST.MF">
+ <fileset dir="${src.dir}">
+ <include name="javassist/**"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="javadocs">
+ <mkdir dir="html"/>
+ <javadoc
+ Locale="en_US"
+ packagenames="javassist.*"
+ excludepackagenames="javassist.compiler.*,javassist.convert.*,javassist.scopedpool.*,javassist.bytecode.stackmap.*"
+ sourcepath="src/main"
+ defaultexcludes="yes"
+ destdir="html"
+ author="true"
+ version="true"
+ use="true"
+ public="true"
+ nohelp="true"
+ windowtitle="Javassist API">
+ <doctitle><![CDATA[<h1>Javassist</h1>]]></doctitle>
+ <bottom><![CDATA[<i>Javassist, a Java-bytecode translator toolkit.<br>
+Copyright (C) 1999-2010 Shigeru Chiba. All Rights Reserved.</i>]]></bottom>
+ </javadoc>
+ </target>
+
+ <target name="dist" depends="jar,javadocs">
+ <delete file="${dist-version}.zip"/>
+ <zip zipfile="${dist-version}.zip">
+ <zipfileset dir="${basedir}" prefix="${dist-version}">
+ <include name="html/**"/>
+ <include name="sample/**"/>
+ <include name="src/main/**"/>
+ <include name="tutorial/**"/>
+ <include name="*.html"/>
+ <include name="*.xml"/>
+ <include name="${target.jar}"/>
+ </zipfileset>
+ </zip>
+ </target>
+
+ <target name="clean">
+ <delete dir="build"/>
+ <delete dir="html"/>
+ <delete file="${target.jar}"/>
+ <delete file="${dist-version}.zip"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Run samples -->
+ <!-- =================================================================== -->
+
+ <target name = "sample-all"
+ depends="sample-test,sample-reflect,sample-duplicate,sample-vector">
+ <echo>** please run sample-rmi, sample-evolve, and</echo>
+ <echo> sample-hotswap (or -hotswap5) separately **</echo>
+ </target>
+
+ <target name = "sample-test" depends="sample" >
+ <java fork="true" dir="${run.dir}" classname="sample.Test">
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
+ <target name = "sample-reflect" depends="sample" >
+ <java fork="true" dir="${run.dir}" classname="javassist.tools.reflect.Loader">
+ <classpath refid="classpath"/>
+ <arg line="sample.reflect.Main Joe" />
+ </java>
+ </target>
+
+ <target name = "sample-duplicate" depends="sample" >
+ <echo>run sample.duplicate.Viewer without reflection</echo>
+ <java fork="true" dir="${run.dir}" classname="sample.duplicate.Viewer">
+ <classpath refid="classpath"/>
+ </java>
+ <echo>run sample.duplicate.Viewer with reflection</echo>
+ <java fork="true" dir="${run.dir}" classname="sample.duplicate.Main">
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
+ <target name = "sample-vector" depends="sample" >
+ <echo>sample.preproc.Compiler sample/vector/Test.j</echo>
+ <java fork="true" dir="${run.dir}" classname="sample.preproc.Compiler">
+ <classpath refid="classpath"/>
+ <arg line="sample/vector/Test.j"/>
+ </java>
+ <echo>javac sample/vector/Test.java</echo>
+ <javac srcdir="${build.classes.dir}"
+ destdir="${build.classes.dir}"
+ includes="sample/vector/Test.java">
+ <classpath refid="classpath"/>
+ </javac>
+ <java fork="true" dir="${run.dir}" classname="sample.vector.Test" />
+ </target>
+
+ <target name = "sample-rmi" depends="sample" >
+ <echo>** Please open sample/rmi/webdemo.html with your browser **</echo>
+ <java fork="true" dir="${run.dir}" classname="sample.rmi.Counter">
+ <classpath refid="classpath"/>
+ <arg value="5001" />
+ </java>
+ </target>
+
+ <target name = "sample-evolve" depends="sample" >
+ <echo>** Please open http://localhost:5003/demo.html with your browser **</echo>
+ <java fork="true" dir="${run.dir}" classname="sample.evolve.DemoLoader">
+ <classpath refid="classpath"/>
+ <arg value="5003" />
+ </java>
+ </target>
+
+ <!-- for JDK 1.4 -->
+ <target name = "sample-hotswap" depends="sample">
+ <echo>** JAVA_HOME/lib/tools.jar must be included in CLASS_PATH</echo>
+ <echo>** for JDK 1.4</echo>
+ <java fork="true" dir="${run.dir}" classname="Test">
+ <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000" />
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
+ <!-- for Java 5 -->
+ <target name = "sample-hotswap5" depends="sample">
+ <echo>** JAVA_HOME/lib/tools.jar must be included in CLASS_PATH</echo>
+ <echo>** for JDK 1.5 or later</echo>
+ <java fork="true" dir="${run.dir}" classname="Test">
+ <jvmarg line="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000" />
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+</project>
Deleted: tags/rel_3_12_0_ga/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/pom.xml 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,138 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <packaging>jar</packaging>
- <description>Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation
- simple. It is a class library for editing bytecodes in Java.
- </description>
- <version>3.12.0-SNAPSHOT</version>
- <name>Javassist</name>
- <url>http://www.javassist.org/</url>
- <distributionManagement>
- <!--
- You need an entry in your .m2/settings.xml like this:
- <servers>
- <server>
- <id>snapshots.jboss.org</id>
- <username>your_jboss.org_username</username>
- <password>password</password>
- </server>
- </servers>
-
- Then to deploy a snapshot, you need to run
-
- mvn deploy mvn deploy -Djboss.snapshots.repo.url=dav:https://snapshots.jboss.org/maven2
- -->
- <snapshotRepository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshot Repository</name>
- <url>${jboss.snapshots.repo.url}</url>
- </snapshotRepository>
- </distributionManagement>
- <build>
- <sourceDirectory>src/main/</sourceDirectory>
- <testSourceDirectory>src/test/</testSourceDirectory>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.4</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifestFile>${project.build.sourceDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.0.3</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- <inherited>true</inherited>
- </plugin>
- </plugins>
- </build>
- <profiles>
- <profile>
- <id>jdk14</id>
- <activation>
- <jdk>1.4</jdk>
- <property>
- <name>!no.tools</name>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- <version>1.4</version>
- <scope>system</scope>
- <optional>true</optional>
- <systemPath>${java.home}/../lib/tools.jar</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>jdk15</id>
- <activation>
- <jdk>1.5</jdk>
- <property>
- <name>!no.tools</name>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- <version>1.5</version>
- <scope>system</scope>
- <optional>true</optional>
- <systemPath>${java.home}/../lib/tools.jar</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>jdk16</id>
- <activation>
- <jdk>1.6</jdk>
- <property>
- <name>!no.tools</name>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- <version>1.6</version>
- <scope>system</scope>
- <optional>true</optional>
- <systemPath>${java.home}/../lib/tools.jar</systemPath>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
Copied: tags/rel_3_12_0_ga/pom.xml (from rev 531, trunk/pom.xml)
===================================================================
--- tags/rel_3_12_0_ga/pom.xml (rev 0)
+++ tags/rel_3_12_0_ga/pom.xml 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,138 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <packaging>jar</packaging>
+ <description>Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation
+ simple. It is a class library for editing bytecodes in Java.
+ </description>
+ <version>3.12.0.GA</version>
+ <name>Javassist</name>
+ <url>http://www.javassist.org/</url>
+ <distributionManagement>
+ <!--
+ You need an entry in your .m2/settings.xml like this:
+ <servers>
+ <server>
+ <id>snapshots.jboss.org</id>
+ <username>your_jboss.org_username</username>
+ <password>password</password>
+ </server>
+ </servers>
+
+ Then to deploy a snapshot, you need to run
+
+ deploy -Djboss.snapshots.repo.url=dav:https://snapshots.jboss.org/maven2
+ -->
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>${jboss.snapshots.repo.url}</url>
+ </snapshotRepository>
+ </distributionManagement>
+ <build>
+ <sourceDirectory>src/main/</sourceDirectory>
+ <testSourceDirectory>src/test/</testSourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>${project.build.sourceDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0.3</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <inherited>true</inherited>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>jdk14</id>
+ <activation>
+ <jdk>1.4</jdk>
+ <property>
+ <name>!no.tools</name>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ <version>1.4</version>
+ <scope>system</scope>
+ <optional>true</optional>
+ <systemPath>${java.home}/../lib/tools.jar</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jdk15</id>
+ <activation>
+ <jdk>1.5</jdk>
+ <property>
+ <name>!no.tools</name>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ <version>1.5</version>
+ <scope>system</scope>
+ <optional>true</optional>
+ <systemPath>${java.home}/../lib/tools.jar</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jdk16</id>
+ <activation>
+ <jdk>1.6</jdk>
+ <property>
+ <name>!no.tools</name>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ <version>1.6</version>
+ <scope>system</scope>
+ <optional>true</optional>
+ <systemPath>${java.home}/../lib/tools.jar</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Deleted: tags/rel_3_12_0_ga/src/main/META-INF/MANIFEST.MF
===================================================================
--- trunk/src/main/META-INF/MANIFEST.MF 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/src/main/META-INF/MANIFEST.MF 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,8 +0,0 @@
-Manifest-Version: 1.1
-Specification-Title: Javassist
-Created-By: Shigeru Chiba, Tokyo Institute of Technology
-Specification-Vendor: Shigeru Chiba, Tokyo Institute of Technology
-Specification-Version: 3.11.0.GA
-Main-Class: javassist.CtClass
-
-Name: javassist/
Copied: tags/rel_3_12_0_ga/src/main/META-INF/MANIFEST.MF (from rev 528, trunk/src/main/META-INF/MANIFEST.MF)
===================================================================
--- tags/rel_3_12_0_ga/src/main/META-INF/MANIFEST.MF (rev 0)
+++ tags/rel_3_12_0_ga/src/main/META-INF/MANIFEST.MF 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.1
+Specification-Title: Javassist
+Created-By: Shigeru Chiba, Tokyo Institute of Technology
+Specification-Vendor: Shigeru Chiba, Tokyo Institute of Technology
+Specification-Version: 3.12.0.GA
+Main-Class: javassist.CtClass
+
+Name: javassist/
Deleted: tags/rel_3_12_0_ga/src/main/javassist/CtClass.java
===================================================================
--- trunk/src/main/javassist/CtClass.java 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/src/main/javassist/CtClass.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,1407 +0,0 @@
-/*
- * Javassist, a Java-bytecode translator toolkit.
- * Copyright (C) 1999-2007 Shigeru Chiba. All Rights Reserved.
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. Alternatively, the contents of this file may be used under
- * the terms of the GNU Lesser General Public License Version 2.1 or later.
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- */
-
-package javassist;
-
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URL;
-import java.security.ProtectionDomain;
-import java.util.Collection;
-import javassist.bytecode.ClassFile;
-import javassist.bytecode.Descriptor;
-import javassist.bytecode.Opcode;
-import javassist.expr.ExprEditor;
-
-/* Note:
- *
- * This class is an abstract class and several methods just return null
- * or throw an exception. Those methods are overridden in subclasses
- * of this class. Read the source code of CtClassType if you are
- * interested in the implementation of Javassist.
- *
- * Subclasses of CtClass are CtClassType, CtPrimitiveType, and CtArray.
- */
-
-/**
- * An instance of <code>CtClass</code> represents a class.
- * It is obtained from <code>ClassPool</code>.
- *
- * @see ClassPool#get(String)
- */
-public abstract class CtClass {
- protected String qualifiedName;
-
- /**
- * The version number of this release.
- */
- public static final String version = "3.11.0.GA";
-
- /**
- * Prints the version number and the copyright notice.
- *
- * <p>The following command invokes this method:
- *
- * <ul><pre>java -jar javassist.jar</pre></ul>
- */
- public static void main(String[] args) {
- System.out.println("Javassist version " + CtClass.version);
- System.out.println("Copyright (C) 1999-2009 Shigeru Chiba."
- + " All Rights Reserved.");
- }
-
- static final String javaLangObject = "java.lang.Object";
-
- /**
- * The <code>CtClass</code> object representing
- * the <code>boolean</code> type.
- */
- public static CtClass booleanType;
-
- /**
- * The <code>CtClass</code> object representing
- * the <code>char</code> type.
- */
- public static CtClass charType;
-
- /**
- * The <code>CtClass</code> object representing
- * the <code>byte</code> type.
- */
- public static CtClass byteType;
-
- /**
- * The <code>CtClass</code> object representing
- * the <code>short</code> type.
- */
- public static CtClass shortType;
-
- /**
- * The <code>CtClass</code> object representing
- * the <code>int</code> type.
- */
- public static CtClass intType;
-
- /**
- * The <code>CtClass</code> object representing
- * the <code>long</code> type.
- */
- public static CtClass longType;
-
- /**
- * The <code>CtClass</code> object representing
- * the <code>float</code> type.
- */
- public static CtClass floatType;
-
- /**
- * The <code>CtClass</code> object representing
- * the <code>double</code> type.
- */
- public static CtClass doubleType;
-
- /**
- * The <code>CtClass</code> object representing
- * the <code>void</code> type.
- */
- public static CtClass voidType;
-
- static CtClass[] primitiveTypes;
-
- static {
- primitiveTypes = new CtClass[9];
-
- booleanType =
- new CtPrimitiveType("boolean", 'Z', "java.lang.Boolean",
- "booleanValue", "()Z", Opcode.IRETURN,
- Opcode.T_BOOLEAN, 1);
- primitiveTypes[0] = booleanType;
-
- charType = new CtPrimitiveType("char", 'C', "java.lang.Character",
- "charValue", "()C", Opcode.IRETURN,
- Opcode.T_CHAR, 1);
- primitiveTypes[1] = charType;
-
- byteType = new CtPrimitiveType("byte", 'B', "java.lang.Byte",
- "byteValue", "()B", Opcode.IRETURN,
- Opcode.T_BYTE, 1);
- primitiveTypes[2] = byteType;
-
- shortType = new CtPrimitiveType("short", 'S', "java.lang.Short",
- "shortValue", "()S", Opcode.IRETURN,
- Opcode.T_SHORT, 1);
- primitiveTypes[3] = shortType;
-
- intType = new CtPrimitiveType("int", 'I', "java.lang.Integer",
- "intValue", "()I", Opcode.IRETURN,
- Opcode.T_INT, 1);
- primitiveTypes[4] = intType;
-
- longType = new CtPrimitiveType("long", 'J', "java.lang.Long",
- "longValue", "()J", Opcode.LRETURN,
- Opcode.T_LONG, 2);
- primitiveTypes[5] = longType;
-
- floatType = new CtPrimitiveType("float", 'F', "java.lang.Float",
- "floatValue", "()F", Opcode.FRETURN,
- Opcode.T_FLOAT, 1);
- primitiveTypes[6] = floatType;
-
- doubleType = new CtPrimitiveType("double", 'D', "java.lang.Double",
- "doubleValue", "()D", Opcode.DRETURN,
- Opcode.T_DOUBLE, 2);
- primitiveTypes[7] = doubleType;
-
- voidType = new CtPrimitiveType("void", 'V', "java.lang.Void",
- null, null, Opcode.RETURN, 0, 0);
- primitiveTypes[8] = voidType;
- }
-
- protected CtClass(String name) {
- qualifiedName = name;
- }
-
- /**
- * Converts the object to a string.
- */
- public String toString() {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append("@");
- buf.append(Integer.toHexString(hashCode()));
- buf.append("[");
- extendToString(buf);
- buf.append("]");
- return buf.toString();
- }
-
- /**
- * Implemented in subclasses to add to the {@link #toString()} result.
- * Subclasses should put a space before each token added to the buffer.
- */
- protected void extendToString(StringBuffer buffer) {
- buffer.append(getName());
- }
-
- /**
- * Returns a <code>ClassPool</code> for this class.
- */
- public ClassPool getClassPool() { return null; }
-
- /**
- * Returns a class file for this class.
- *
- * <p>This method is not available if <code>isFrozen()</code>
- * is true.
- */
- public ClassFile getClassFile() {
- checkModify();
- return getClassFile2();
- }
-
- /**
- * Returns a class file for this class (read only).
- * Normal applications do not need calling this method. Use
- * <code>getClassFile()</code>.
- *
- * <p>The <code>ClassFile</code> object obtained by this method
- * is read only. Changes to this object might not be reflected
- * on a class file generated by <code>toBytecode()</code>,
- * <code>toClass()</code>, etc.
- *
- * <p>This method is available even if <code>isFrozen()</code>
- * is true. However, if the class is frozen, it might be also
- * pruned.
- *
- * @see CtClass#getClassFile()
- * @see CtClass#isFrozen()
- * @see CtClass#prune()
- */
- public ClassFile getClassFile2() { return null; }
-
- /**
- * Undocumented method. Do not use; internal-use only.
- */
- public javassist.compiler.AccessorMaker getAccessorMaker() {
- return null;
- }
-
- /**
- * Returns the uniform resource locator (URL) of the class file.
- */
- public URL getURL() throws NotFoundException {
- throw new NotFoundException(getName());
- }
-
- /**
- * Returns true if the definition of the class has been modified.
- */
- public boolean isModified() { return false; }
-
- /**
- * Returns true if the class has been loaded or written out
- * and thus it cannot be modified any more.
- *
- * @see #defrost()
- * @see #detach()
- */
- public boolean isFrozen() { return true; }
-
- /**
- * Makes the class frozen.
- *
- * @see #isFrozen()
- * @see #defrost()
- * @since 3.6
- */
- public void freeze() {}
-
- /* Note: this method is overridden by CtClassType
- */
- void checkModify() throws RuntimeException {
- if (isFrozen())
- throw new RuntimeException(getName() + " class is frozen");
-
- // isModified() must return true after this method is invoked.
- }
-
- /**
- * Defrosts the class so that the class can be modified again.
- *
- * <p>To avoid changes that will be never reflected,
- * the class is frozen to be unmodifiable if it is loaded or
- * written out. This method should be called only in a case
- * that the class will be reloaded or written out later again.
- *
- * <p>If <code>defrost()</code> will be called later, pruning
- * must be disallowed in advance.
- *
- * @see #isFrozen()
- * @see #stopPruning(boolean)
- * @see #detach()
- */
- public void defrost() {
- throw new RuntimeException("cannot defrost " + getName());
- }
-
- /**
- * Returns <code>true</code> if this object represents a primitive
- * Java type: boolean, byte, char, short, int, long, float, double,
- * or void.
- */
- public boolean isPrimitive() { return false; }
-
- /**
- * Returns <code>true</code> if this object represents an array type.
- */
- public boolean isArray() {
- return false;
- }
-
- /**
- * If this object represents an array, this method returns the component
- * type of the array. Otherwise, it returns <code>null</code>.
- */
- public CtClass getComponentType() throws NotFoundException {
- return null;
- }
-
- /**
- * Returns <code>true</code> if this class extends or implements
- * <code>clazz</code>. It also returns <code>true</code> if
- * this class is the same as <code>clazz</code>.
- */
- public boolean subtypeOf(CtClass clazz) throws NotFoundException {
- return this == clazz || getName().equals(clazz.getName());
- }
-
- /**
- * Obtains the fully-qualified name of the class.
- */
- public String getName() { return qualifiedName; }
-
- /**
- * Obtains the not-qualified class name.
- */
- public final String getSimpleName() {
- String qname = qualifiedName;
- int index = qname.lastIndexOf('.');
- if (index < 0)
- return qname;
- else
- return qname.substring(index + 1);
- }
-
- /**
- * Obtains the package name. It may be <code>null</code>.
- */
- public final String getPackageName() {
- String qname = qualifiedName;
- int index = qname.lastIndexOf('.');
- if (index < 0)
- return null;
- else
- return qname.substring(0, index);
- }
-
- /**
- * Sets the class name
- *
- * @param name fully-qualified name
- */
- public void setName(String name) {
- checkModify();
- if (name != null)
- qualifiedName = name;
- }
-
- /**
- * Substitutes <code>newName</code> for all occurrences of a class
- * name <code>oldName</code> in the class file.
- *
- * @param oldName replaced class name
- * @param newName substituted class name
- */
- public void replaceClassName(String oldName, String newName) {
- checkModify();
- }
-
- /**
- * Changes class names appearing in the class file according to the
- * given <code>map</code>.
- *
- * <p>All the class names appearing in the class file are tested
- * with <code>map</code> to determine whether each class name is
- * replaced or not. Thus this method can be used for collecting
- * all the class names in the class file. To do that, first define
- * a subclass of <code>ClassMap</code> so that <code>get()</code>
- * records all the given parameters. Then, make an instance of
- * that subclass as an empty hash-table. Finally, pass that instance
- * to this method. After this method finishes, that instance would
- * contain all the class names appearing in the class file.
- *
- * @param map the hashtable associating replaced class names
- * with substituted names.
- */
- public void replaceClassName(ClassMap map) {
- checkModify();
- }
-
- /**
- * Returns a collection of the names of all the classes
- * referenced in this class.
- * That collection includes the name of this class.
- *
- * <p>This method may return <code>null</code>.
- */
- public synchronized Collection getRefClasses() {
- ClassFile cf = getClassFile2();
- if (cf != null) {
- ClassMap cm = new ClassMap() {
- public void put(String oldname, String newname) {
- put0(oldname, newname);
- }
-
- public Object get(Object jvmClassName) {
- String n = toJavaName((String)jvmClassName);
- put0(n, n);
- return null;
- }
-
- public void fix(String name) {}
- };
- cf.renameClass(cm);
- return cm.values();
- }
- else
- return null;
- }
-
- /**
- * Determines whether this object represents a class or an interface.
- * It returns <code>true</code> if this object represents an interface.
- */
- public boolean isInterface() {
- return false;
- }
-
- /**
- * Determines whether this object represents an annotation type.
- * It returns <code>true</code> if this object represents an annotation type.
- *
- * @since 3.2
- */
- public boolean isAnnotation() {
- return false;
- }
-
- /**
- * Determines whether this object represents an enum.
- * It returns <code>true</code> if this object represents an enum.
- *
- * @since 3.2
- */
- public boolean isEnum() {
- return false;
- }
-
- /**
- * Returns the modifiers for this class, encoded in an integer.
- * For decoding, use <code>javassist.Modifier</code>.
- *
- * <p>If the class is a static nested class (a.k.a. static inner class),
- * the returned modifiers include <code>Modifier.STATIC</code>.
- *
- * @see Modifier
- */
- public int getModifiers() {
- return 0;
- }
-
- /**
- * Returns true if the class has the specified annotation class.
- *
- * @param clz the annotation class.
- * @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
- * @since 3.11
- */
- public boolean hasAnnotation(Class clz) {
- return false;
- }
-
- /**
- * Returns the annotation if the class has the specified annotation class.
- * For example, if an annotation <code>@Author</code> is associated
- * with this class, an <code>Author</code> object is returned.
- * The member values can be obtained by calling methods on
- * the <code>Author</code> object.
- *
- * @param clz the annotation class.
- * @return the annotation if found, otherwise <code>null</code>.
- * @since 3.11
- */
- public Object getAnnotation(Class clz) throws ClassNotFoundException {
- return null;
- }
-
- /**
- * Returns the annotations associated with this class.
- * For example, if an annotation <code>@Author</code> is associated
- * with this class, the returned array contains an <code>Author</code>
- * object. The member values can be obtained by calling methods on
- * the <code>Author</code> object.
- *
- * @return an array of annotation-type objects.
- * @see CtMember#getAnnotations()
- * @since 3.1
- */
- public Object[] getAnnotations() throws ClassNotFoundException {
- return new Object[0];
- }
-
- /**
- * Returns the annotations associated with this class.
- * This method is equivalent to <code>getAnnotations()</code>
- * except that, if any annotations are not on the classpath,
- * they are not included in the returned array.
- *
- * @return an array of annotation-type objects.
- * @see #getAnnotations()
- * @see CtMember#getAvailableAnnotations()
- * @since 3.3
- */
- public Object[] getAvailableAnnotations(){
- return new Object[0];
- }
-
- /**
- * Returns an array of nested classes declared in the class.
- * Nested classes are inner classes, anonymous classes, local classes,
- * and static nested classes.
- *
- * @since 3.2
- */
- public CtClass[] getNestedClasses() throws NotFoundException {
- return new CtClass[0];
- }
-
- /**
- * Sets the modifiers.
- *
- * <p>If the class is a nested class, this method also modifies
- * the class declaring that nested class (i.e. the enclosing
- * class is modified).
- *
- * @param mod modifiers encoded by
- * <code>javassist.Modifier</code>
- * @see Modifier
- */
- public void setModifiers(int mod) {
- checkModify();
- }
-
- /**
- * Determines whether the class directly or indirectly extends
- * the given class. If this class extends a class A and
- * the class A extends a class B, then subclassof(B) returns true.
- *
- * <p>This method returns true if the given class is identical to
- * the class represented by this object.
- */
- public boolean subclassOf(CtClass superclass) {
- return false;
- }
-
- /**
- * Obtains the class object representing the superclass of the
- * class.
- * It returns null if this object represents the
- * <code>java.lang.Object</code> class and thus it does not have
- * the super class.
- *
- * <p>If this object represents an interface, this method
- * always returns the <code>java.lang.Object</code> class.
- * To obtain the super interfaces
- * extended by that interface, call <code>getInterfaces()</code>.
- */
- public CtClass getSuperclass() throws NotFoundException {
- return null;
- }
-
- /**
- * Changes a super class unless this object represents an interface.
- * The new super class must be compatible with the old one; for example,
- * it should inherit from the old super class.
- *
- * <p>If this object represents an interface, this method is equivalent
- * to <code>addInterface()</code>; it appends <code>clazz</code> to
- * the list of the super interfaces extended by that interface.
- * Note that an interface can extend multiple super interfaces.
- *
- * @see #replaceClassName(String, String)
- * @see #replaceClassName(ClassMap)
- */
- public void setSuperclass(CtClass clazz) throws CannotCompileException {
- checkModify();
- }
-
- /**
- * Obtains the class objects representing the interfaces implemented
- * by the class or, if this object represents an interface, the interfaces
- * extended by that interface.
- */
- public CtClass[] getInterfaces() throws NotFoundException {
- return new CtClass[0];
- }
-
- /**
- * Sets implemented interfaces. If this object represents an interface,
- * this method sets the interfaces extended by that interface.
- *
- * @param list a list of the <code>CtClass</code> objects
- * representing interfaces, or
- * <code>null</code> if the class implements
- * no interfaces.
- */
- public void setInterfaces(CtClass[] list) {
- checkModify();
- }
-
- /**
- * Adds an interface.
- *
- * @param anInterface the added interface.
- */
- public void addInterface(CtClass anInterface) {
- checkModify();
- }
-
- /**
- * If this class is a member class or interface of another class,
- * then the class enclosing this class is returned.
- *
- * @return null if this class is a top-level class or an anonymous class.
- */
- public CtClass getDeclaringClass() throws NotFoundException {
- return null;
- }
-
- /**
- * Returns the immediately enclosing method of this class.
- * This method works only with JDK 1.5 or later.
- *
- * @return null if this class is not a local class or an anonymous
- * class.
- */
- public CtMethod getEnclosingMethod() throws NotFoundException {
- return null;
- }
-
- /**
- * Makes a new public nested class. If this method is called,
- * the <code>CtClass</code>, which encloses the nested class, is modified
- * since a class file includes a list of nested classes.
- *
- * <p>The current implementation only supports a static nested class.
- * <code>isStatic</code> must be true.
- *
- * @param name the simple name of the nested class.
- * @param isStatic true if the nested class is static.
- */
- public CtClass makeNestedClass(String name, boolean isStatic) {
- throw new RuntimeException(getName() + " is not a class");
- }
-
- /**
- * Returns an array containing <code>CtField</code> objects
- * representing all the non-private fields of the class.
- * That array includes non-private fields inherited from the
- * superclasses.
- */
- public CtField[] getFields() { return new CtField[0]; }
-
- /**
- * Returns the field with the specified name. The returned field
- * may be a private field declared in a super class or interface.
- */
- public CtField getField(String name) throws NotFoundException {
- throw new NotFoundException(name);
- }
-
- /**
- * @return null if the specified field is not found.
- */
- CtField getField2(String name) { return null; }
-
- /**
- * Gets all the fields declared in the class. The inherited fields
- * are not included.
- *
- * <p>Note: the result does not include inherited fields.
- */
- public CtField[] getDeclaredFields() { return new CtField[0]; }
-
- /**
- * Retrieves the field with the specified name among the fields
- * declared in the class.
- *
- * <p>Note: this method does not search the superclasses.
- */
- public CtField getDeclaredField(String name) throws NotFoundException {
- throw new NotFoundException(name);
- }
-
- /**
- * Gets all the constructors and methods declared in the class.
- */
- public CtBehavior[] getDeclaredBehaviors() {
- return new CtBehavior[0];
- }
-
- /**
- * Returns an array containing <code>CtConstructor</code> objects
- * representing all the non-private constructors of the class.
- */
- public CtConstructor[] getConstructors() {
- return new CtConstructor[0];
- }
-
- /**
- * Returns the constructor with the given signature,
- * which is represented by a character string
- * called method descriptor.
- * For details of the method descriptor, see the JVM specification
- * or <code>javassist.bytecode.Descriptor</code>.
- *
- * @param desc method descriptor
- * @see javassist.bytecode.Descriptor
- */
- public CtConstructor getConstructor(String desc)
- throws NotFoundException
- {
- throw new NotFoundException("no such a constructor");
- }
-
- /**
- * Gets all the constructors declared in the class.
- *
- * @see javassist.CtConstructor
- */
- public CtConstructor[] getDeclaredConstructors() {
- return new CtConstructor[0];
- }
-
- /**
- * Returns a constructor receiving the specified parameters.
- *
- * @param params parameter types.
- */
- public CtConstructor getDeclaredConstructor(CtClass[] params)
- throws NotFoundException
- {
- String desc = Descriptor.ofConstructor(params);
- return getConstructor(desc);
- }
-
- /**
- * Gets the class initializer (static constructor)
- * declared in the class.
- * This method returns <code>null</code> if
- * no class initializer is not declared.
- *
- * @see #makeClassInitializer()
- * @see javassist.CtConstructor
- */
- public CtConstructor getClassInitializer() {
- return null;
- }
-
- /**
- * Returns an array containing <code>CtMethod</code> objects
- * representing all the non-private methods of the class.
- * That array includes non-private methods inherited from the
- * superclasses.
- */
- public CtMethod[] getMethods() {
- return new CtMethod[0];
- }
-
- /**
- * Returns the method with the given name and signature.
- * The returned method may be declared in a super class.
- * The method signature is represented by a character string
- * called method descriptor,
- * which is defined in the JVM specification.
- *
- * @param name method name
- * @param desc method descriptor
- * @see CtBehavior#getSignature()
- * @see javassist.bytecode.Descriptor
- */
- public CtMethod getMethod(String name, String desc)
- throws NotFoundException
- {
- throw new NotFoundException(name);
- }
-
- /**
- * Gets all methods declared in the class. The inherited methods
- * are not included.
- *
- * @see javassist.CtMethod
- */
- public CtMethod[] getDeclaredMethods() {
- return new CtMethod[0];
- }
-
- /**
- * Retrieves the method with the specified name and parameter types
- * among the methods declared in the class.
- *
- * <p>Note: this method does not search the superclasses.
- *
- * @param name method name
- * @param params parameter types
- * @see javassist.CtMethod
- */
- public CtMethod getDeclaredMethod(String name, CtClass[] params)
- throws NotFoundException
- {
- throw new NotFoundException(name);
- }
-
- /**
- * Retrieves the method with the specified name among the methods
- * declared in the class. If there are multiple methods with
- * the specified name, then this method returns one of them.
- *
- * <p>Note: this method does not search the superclasses.
- *
- * @see javassist.CtMethod
- */
- public CtMethod getDeclaredMethod(String name) throws NotFoundException {
- throw new NotFoundException(name);
- }
-
- /**
- * Makes an empty class initializer (static constructor).
- * If the class already includes a class initializer,
- * this method returns it.
- *
- * @see #getClassInitializer()
- */
- public CtConstructor makeClassInitializer()
- throws CannotCompileException
- {
- throw new CannotCompileException("not a class");
- }
-
- /**
- * Adds a constructor. To add a class initializer (static constructor),
- * call <code>makeClassInitializer()</code>.
- *
- * @see #makeClassInitializer()
- */
- public void addConstructor(CtConstructor c)
- throws CannotCompileException
- {
- checkModify();
- }
-
- /**
- * Removes a constructor declared in this class.
- *
- * @param c removed constructor.
- * @throws NotFoundException if the constructor is not found.
- */
- public void removeConstructor(CtConstructor c) throws NotFoundException {
- checkModify();
- }
-
- /**
- * Adds a method.
- */
- public void addMethod(CtMethod m) throws CannotCompileException {
- checkModify();
- }
-
- /**
- * Removes a method declared in this class.
- *
- * @param m removed method.
- * @throws NotFoundException if the method is not found.
- */
- public void removeMethod(CtMethod m) throws NotFoundException {
- checkModify();
- }
-
- /**
- * Adds a field.
- *
- * <p>The <code>CtField</code> belonging to another
- * <code>CtClass</code> cannot be directly added to this class.
- * Only a field created for this class can be added.
- *
- * @see javassist.CtField#CtField(CtField,CtClass)
- */
- public void addField(CtField f) throws CannotCompileException {
- addField(f, (CtField.Initializer)null);
- }
-
- /**
- * Adds a field with an initial value.
- *
- * <p>The <code>CtField</code> belonging to another
- * <code>CtClass</code> cannot be directly added to this class.
- * Only a field created for this class can be added.
- *
- * <p>The initial value is given as an expression written in Java.
- * Any regular Java expression can be used for specifying the initial
- * value. The followings are examples.
- *
- * <ul><pre>
- * cc.addField(f, "0") // the initial value is 0.
- * cc.addField(f, "i + 1") // i + 1.
- * cc.addField(f, "new Point()"); // a Point object.
- * </pre></ul>
- *
- * <p>Here, the type of variable <code>cc</code> is <code>CtClass</code>.
- * The type of <code>f</code> is <code>CtField</code>.
- *
- * <p>Note: do not change the modifier of the field
- * (in particular, do not add or remove <code>static</code>
- * to/from the modifier)
- * after it is added to the class by <code>addField()</code>.
- *
- * @param init an expression for the initial value.
- *
- * @see javassist.CtField.Initializer#byExpr(String)
- * @see javassist.CtField#CtField(CtField,CtClass)
- */
- public void addField(CtField f, String init)
- throws CannotCompileException
- {
- checkModify();
- }
-
- /**
- * Adds a field with an initial value.
- *
- * <p>The <code>CtField</code> belonging to another
- * <code>CtClass</code> cannot be directly added to this class.
- * Only a field created for this class can be added.
- *
- * <p>For example,
- *
- * <ul><pre>
- * CtClass cc = ...;
- * addField(new CtField(CtClass.intType, "i", cc),
- * CtField.Initializer.constant(1));
- * </pre></ul>
- *
- * <p>This code adds an <code>int</code> field named "i". The
- * initial value of this field is 1.
- *
- * @param init specifies the initial value of the field.
- *
- * @see javassist.CtField#CtField(CtField,CtClass)
- */
- public void addField(CtField f, CtField.Initializer init)
- throws CannotCompileException
- {
- checkModify();
- }
-
- /**
- * Removes a field declared in this class.
- *
- * @param f removed field.
- * @throws NotFoundException if the field is not found.
- */
- public void removeField(CtField f) throws NotFoundException {
- checkModify();
- }
-
- /**
- * Obtains an attribute with the given name.
- * If that attribute is not found in the class file, this
- * method returns null.
- *
- * <p>This is a convenient method mainly for obtaining
- * a user-defined attribute. For dealing with attributes, see the
- * <code>javassist.bytecode</code> package. For example, the following
- * expression returns all the attributes of a class file.
- *
- * <ul><pre>
- * getClassFile().getAttributes()
- * </pre></ul>
- *
- * @param name attribute name
- * @see javassist.bytecode.AttributeInfo
- */
- public byte[] getAttribute(String name) {
- return null;
- }
-
- /**
- * Adds a named attribute.
- * An arbitrary data (smaller than 64Kb) can be saved in the class
- * file. Some attribute name are reserved by the JVM.
- * The attributes with the non-reserved names are ignored when a
- * class file is loaded into the JVM.
- * If there is already an attribute with
- * the same name, this method substitutes the new one for it.
- *
- * <p>This is a convenient method mainly for adding
- * a user-defined attribute. For dealing with attributes, see the
- * <code>javassist.bytecode</code> package. For example, the following
- * expression adds an attribute <code>info</code> to a class file.
- *
- * <ul><pre>
- * getClassFile().addAttribute(info)
- * </pre></ul>
- *
- * @param name attribute name
- * @param data attribute value
- * @see javassist.bytecode.AttributeInfo
- */
- public void setAttribute(String name, byte[] data) {
- checkModify();
- }
-
- /**
- * Applies the given converter to all methods and constructors
- * declared in the class. This method calls <code>instrument()</code>
- * on every <code>CtMethod</code> and <code>CtConstructor</code> object
- * in the class.
- *
- * @param converter specifies how to modify.
- */
- public void instrument(CodeConverter converter)
- throws CannotCompileException
- {
- checkModify();
- }
-
- /**
- * Modifies the bodies of all methods and constructors
- * declared in the class. This method calls <code>instrument()</code>
- * on every <code>CtMethod</code> and <code>CtConstructor</code> object
- * in the class.
- *
- * @param editor specifies how to modify.
- */
- public void instrument(ExprEditor editor)
- throws CannotCompileException
- {
- checkModify();
- }
-
- /**
- * Converts this class to a <code>java.lang.Class</code> object.
- * Once this method is called, further modifications are not
- * allowed any more.
- * To load the class, this method uses the context class loader
- * of the current thread. If the program is running on some application
- * server, the context class loader might be inappropriate to load the
- * class.
- *
- * <p>This method is provided for convenience. If you need more
- * complex functionality, you should write your own class loader.
- *
- * <p>Note: this method calls <code>toClass()</code>
- * in <code>ClassPool</code>.
- *
- * <p><b>Warining:</b> A Class object returned by this method may not
- * work with a security manager or a signed jar file because a
- * protection domain is not specified.
- *
- * @see #toClass(java.lang.ClassLoader,ProtectionDomain)
- * @see ClassPool#toClass(CtClass)
- */
- public Class toClass() throws CannotCompileException {
- return getClassPool().toClass(this);
- }
-
- /**
- * Converts this class to a <code>java.lang.Class</code> object.
- * Once this method is called, further modifications are not allowed
- * any more.
- *
- * <p>The class file represented by this <code>CtClass</code> is
- * loaded by the given class loader to construct a
- * <code>java.lang.Class</code> object. Since a private method
- * on the class loader is invoked through the reflection API,
- * the caller must have permissions to do that.
- *
- * <p>An easy way to obtain <code>ProtectionDomain</code> object is
- * to call <code>getProtectionDomain()</code>
- * in <code>java.lang.Class</code>. It returns the domain that
- * the class belongs to.
- *
- * <p>This method is provided for convenience. If you need more
- * complex functionality, you should write your own class loader.
- *
- * <p>Note: this method calls <code>toClass()</code>
- * in <code>ClassPool</code>.
- *
- * @param loader the class loader used to load this class.
- * If it is null, the class loader returned by
- * {@link ClassPool#getClassLoader()} is used.
- * @param domain the protection domain that the class belongs to.
- * If it is null, the default domain created
- * by <code>java.lang.ClassLoader</code> is used.
- * @see ClassPool#toClass(CtClass,java.lang.ClassLoader)
- * @since 3.3
- */
- public Class toClass(ClassLoader loader, ProtectionDomain domain)
- throws CannotCompileException
- {
- ClassPool cp = getClassPool();
- if (loader == null)
- loader = cp.getClassLoader();
-
- return cp.toClass(this, loader, domain);
- }
-
- /**
- * Converts this class to a <code>java.lang.Class</code> object.
- *
- * <p><b>Warining:</b> A Class object returned by this method may not
- * work with a security manager or a signed jar file because a
- * protection domain is not specified.
- *
- * @deprecated Replaced by {@link #toClass(ClassLoader,ProtectionDomain)}
- */
- public final Class toClass(ClassLoader loader)
- throws CannotCompileException
- {
- return getClassPool().toClass(this, loader);
- }
-
- /**
- * Removes this <code>CtClass</code> object from the
- * <code>ClassPool</code>.
- * After this method is called, any method cannot be called on the
- * removed <code>CtClass</code> object.
- *
- * <p>If <code>get()</code> in <code>ClassPool</code> is called
- * with the name of the removed method,
- * the <code>ClassPool</code> will read the class file again
- * and constructs another <code>CtClass</code> object representing
- * the same class.
- */
- public void detach() {
- ClassPool cp = getClassPool();
- CtClass obj = cp.removeCached(getName());
- if (obj != this)
- cp.cacheCtClass(getName(), obj, false);
- }
-
- /**
- * Disallows (or allows) automatically pruning this <code>CtClass</code>
- * object.
- *
- * <p>
- * Javassist can automatically prune a <code>CtClass</code> object
- * when <code>toBytecode()</code> (or <code>toClass()</code>,
- * <code>writeFile()</code>) is called.
- * Since a <code>ClassPool</code> holds all instances of <code>CtClass</code>
- * even after <code>toBytecode()</code> (or <code>toClass()</code>,
- * <code>writeFile()</code>) is called, pruning may significantly
- * save memory consumption.
- *
- * <p>If <code>ClassPool.doPruning</code> is true, the automatic pruning
- * is on by default. Otherwise, it is off. The default value of
- * <code>ClassPool.doPruning</code> is false.
- *
- * @param stop disallow pruning if true. Otherwise, allow.
- * @return the previous status of pruning. true if pruning is already stopped.
- *
- * @see #detach()
- * @see #prune()
- * @see ClassPool#doPruning
- */
- public boolean stopPruning(boolean stop) { return true; }
-
- /**
- * Discards unnecessary attributes, in particular,
- * <code>CodeAttribute</code>s (method bodies) of the class,
- * to minimize the memory footprint.
- * After calling this method, the class is read only.
- * It cannot be modified any more.
- * Furthermore, <code>toBytecode()</code>,
- * <code>writeFile()</code>, <code>toClass()</code>,
- * or <code>instrument()</code> cannot be called.
- * However, the method names and signatures in the class etc.
- * are still accessible.
- *
- * <p><code>toBytecode()</code>, <code>writeFile()</code>, and
- * <code>toClass()</code> internally call this method if
- * automatic pruning is on.
- *
- * <p>According to some experiments, pruning does not really reduce
- * memory consumption. Only about 20%. Since pruning takes time,
- * it might not pay off. So the automatic pruning is off by default.
- *
- * @see #stopPruning(boolean)
- * @see #detach()
- * @see ClassPool#doPruning
- *
- * @see #toBytecode()
- * @see #toClass()
- * @see #writeFile()
- * @see #instrument(CodeConverter)
- * @see #instrument(ExprEditor)
- */
- public void prune() {}
-
- /* Called by get() in ClassPool.
- * CtClassType overrides this method.
- */
- void incGetCounter() {}
-
- /**
- * If this method is called, the class file will be
- * rebuilt when it is finally generated by
- * <code>toBytecode()</code> and <code>writeFile()</code>.
- * For a performance reason, the symbol table of the
- * class file may contain unused entries, for example,
- * after a method or a filed is deleted.
- * This method
- * removes those unused entries. This removal will
- * minimize the size of the class file.
- *
- * @since 3.8.1
- */
- public void rebuildClassFile() {}
-
- /**
- * Converts this class to a class file.
- * Once this method is called, further modifications are not
- * possible any more.
- *
- * @return the contents of the class file.
- */
- public byte[] toBytecode() throws IOException, CannotCompileException {
- ByteArrayOutputStream barray = new ByteArrayOutputStream();
- DataOutputStream out = new DataOutputStream(barray);
- try {
- toBytecode(out);
- }
- finally {
- out.close();
- }
-
- return barray.toByteArray();
- }
-
- /**
- * Writes a class file represented by this <code>CtClass</code>
- * object in the current directory.
- * Once this method is called, further modifications are not
- * possible any more.
- *
- * @see #debugWriteFile()
- */
- public void writeFile()
- throws NotFoundException, IOException, CannotCompileException
- {
- writeFile(".");
- }
-
- /**
- * Writes a class file represented by this <code>CtClass</code>
- * object on a local disk.
- * Once this method is called, further modifications are not
- * possible any more.
- *
- * @param directoryName it must end without a directory separator.
- * @see #debugWriteFile(String)
- */
- public void writeFile(String directoryName)
- throws CannotCompileException, IOException
- {
- String classname = getName();
- String filename = directoryName + File.separatorChar
- + classname.replace('.', File.separatorChar) + ".class";
- int pos = filename.lastIndexOf(File.separatorChar);
- if (pos > 0) {
- String dir = filename.substring(0, pos);
- if (!dir.equals("."))
- new File(dir).mkdirs();
- }
-
- DataOutputStream out
- = new DataOutputStream(new BufferedOutputStream(
- new DelayedFileOutputStream(filename)));
- try {
- toBytecode(out);
- }
- finally {
- out.close();
- }
- }
-
- /**
- * Writes a class file as <code>writeFile()</code> does although this
- * method does not prune or freeze the class after writing the class
- * file. Note that, once <code>writeFile()</code> or <code>toBytecode()</code>
- * is called, it cannot be called again since the class is pruned and frozen.
- * This method would be useful for debugging.
- */
- public void debugWriteFile() {
- debugWriteFile(".");
- }
-
- /**
- * Writes a class file as <code>writeFile()</code> does although this
- * method does not prune or freeze the class after writing the class
- * file. Note that, once <code>writeFile()</code> or <code>toBytecode()</code>
- * is called, it cannot be called again since the class is pruned and frozen.
- * This method would be useful for debugging.
- *
- * @param directoryName it must end without a directory separator.
- */
- public void debugWriteFile(String directoryName) {
- try {
- boolean p = stopPruning(true);
- writeFile(directoryName);
- defrost();
- stopPruning(p);
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- static class DelayedFileOutputStream extends OutputStream {
- private FileOutputStream file;
- private String filename;
-
- DelayedFileOutputStream(String name) {
- file = null;
- filename = name;
- }
-
- private void init() throws IOException {
- if (file == null)
- file = new FileOutputStream(filename);
- }
-
- public void write(int b) throws IOException {
- init();
- file.write(b);
- }
-
- public void write(byte[] b) throws IOException {
- init();
- file.write(b);
- }
-
- public void write(byte[] b, int off, int len) throws IOException {
- init();
- file.write(b, off, len);
-
- }
-
- public void flush() throws IOException {
- init();
- file.flush();
- }
-
- public void close() throws IOException {
- init();
- file.close();
- }
- }
-
- /**
- * Converts this class to a class file.
- * Once this method is called, further modifications are not
- * possible any more.
- *
- * <p>This method dose not close the output stream in the end.
- *
- * @param out the output stream that a class file is written to.
- */
- public void toBytecode(DataOutputStream out)
- throws CannotCompileException, IOException
- {
- throw new CannotCompileException("not a class");
- }
-
- /**
- * Makes a unique member name. This method guarantees that
- * the returned name is not used as a prefix of any methods
- * or fields visible in this class.
- * If the returned name is XYZ, then any method or field names
- * in this class do not start with XYZ.
- *
- * @param prefix the prefix of the member name.
- */
- public String makeUniqueName(String prefix) {
- throw new RuntimeException("not available in " + getName());
- }
-
- /* Invoked from ClassPool#compress().
- * This method is overridden by CtClassType.
- */
- void compress() {}
-}
Copied: tags/rel_3_12_0_ga/src/main/javassist/CtClass.java (from rev 531, trunk/src/main/javassist/CtClass.java)
===================================================================
--- tags/rel_3_12_0_ga/src/main/javassist/CtClass.java (rev 0)
+++ tags/rel_3_12_0_ga/src/main/javassist/CtClass.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,1407 @@
+/*
+ * Javassist, a Java-bytecode translator toolkit.
+ * Copyright (C) 1999-2007 Shigeru Chiba. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. Alternatively, the contents of this file may be used under
+ * the terms of the GNU Lesser General Public License Version 2.1 or later.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ */
+
+package javassist;
+
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URL;
+import java.security.ProtectionDomain;
+import java.util.Collection;
+import javassist.bytecode.ClassFile;
+import javassist.bytecode.Descriptor;
+import javassist.bytecode.Opcode;
+import javassist.expr.ExprEditor;
+
+/* Note:
+ *
+ * This class is an abstract class and several methods just return null
+ * or throw an exception. Those methods are overridden in subclasses
+ * of this class. Read the source code of CtClassType if you are
+ * interested in the implementation of Javassist.
+ *
+ * Subclasses of CtClass are CtClassType, CtPrimitiveType, and CtArray.
+ */
+
+/**
+ * An instance of <code>CtClass</code> represents a class.
+ * It is obtained from <code>ClassPool</code>.
+ *
+ * @see ClassPool#get(String)
+ */
+public abstract class CtClass {
+ protected String qualifiedName;
+
+ /**
+ * The version number of this release.
+ */
+ public static final String version = "3.12.0.GA";
+
+ /**
+ * Prints the version number and the copyright notice.
+ *
+ * <p>The following command invokes this method:
+ *
+ * <ul><pre>java -jar javassist.jar</pre></ul>
+ */
+ public static void main(String[] args) {
+ System.out.println("Javassist version " + CtClass.version);
+ System.out.println("Copyright (C) 1999-2010 Shigeru Chiba."
+ + " All Rights Reserved.");
+ }
+
+ static final String javaLangObject = "java.lang.Object";
+
+ /**
+ * The <code>CtClass</code> object representing
+ * the <code>boolean</code> type.
+ */
+ public static CtClass booleanType;
+
+ /**
+ * The <code>CtClass</code> object representing
+ * the <code>char</code> type.
+ */
+ public static CtClass charType;
+
+ /**
+ * The <code>CtClass</code> object representing
+ * the <code>byte</code> type.
+ */
+ public static CtClass byteType;
+
+ /**
+ * The <code>CtClass</code> object representing
+ * the <code>short</code> type.
+ */
+ public static CtClass shortType;
+
+ /**
+ * The <code>CtClass</code> object representing
+ * the <code>int</code> type.
+ */
+ public static CtClass intType;
+
+ /**
+ * The <code>CtClass</code> object representing
+ * the <code>long</code> type.
+ */
+ public static CtClass longType;
+
+ /**
+ * The <code>CtClass</code> object representing
+ * the <code>float</code> type.
+ */
+ public static CtClass floatType;
+
+ /**
+ * The <code>CtClass</code> object representing
+ * the <code>double</code> type.
+ */
+ public static CtClass doubleType;
+
+ /**
+ * The <code>CtClass</code> object representing
+ * the <code>void</code> type.
+ */
+ public static CtClass voidType;
+
+ static CtClass[] primitiveTypes;
+
+ static {
+ primitiveTypes = new CtClass[9];
+
+ booleanType =
+ new CtPrimitiveType("boolean", 'Z', "java.lang.Boolean",
+ "booleanValue", "()Z", Opcode.IRETURN,
+ Opcode.T_BOOLEAN, 1);
+ primitiveTypes[0] = booleanType;
+
+ charType = new CtPrimitiveType("char", 'C', "java.lang.Character",
+ "charValue", "()C", Opcode.IRETURN,
+ Opcode.T_CHAR, 1);
+ primitiveTypes[1] = charType;
+
+ byteType = new CtPrimitiveType("byte", 'B', "java.lang.Byte",
+ "byteValue", "()B", Opcode.IRETURN,
+ Opcode.T_BYTE, 1);
+ primitiveTypes[2] = byteType;
+
+ shortType = new CtPrimitiveType("short", 'S', "java.lang.Short",
+ "shortValue", "()S", Opcode.IRETURN,
+ Opcode.T_SHORT, 1);
+ primitiveTypes[3] = shortType;
+
+ intType = new CtPrimitiveType("int", 'I', "java.lang.Integer",
+ "intValue", "()I", Opcode.IRETURN,
+ Opcode.T_INT, 1);
+ primitiveTypes[4] = intType;
+
+ longType = new CtPrimitiveType("long", 'J', "java.lang.Long",
+ "longValue", "()J", Opcode.LRETURN,
+ Opcode.T_LONG, 2);
+ primitiveTypes[5] = longType;
+
+ floatType = new CtPrimitiveType("float", 'F', "java.lang.Float",
+ "floatValue", "()F", Opcode.FRETURN,
+ Opcode.T_FLOAT, 1);
+ primitiveTypes[6] = floatType;
+
+ doubleType = new CtPrimitiveType("double", 'D', "java.lang.Double",
+ "doubleValue", "()D", Opcode.DRETURN,
+ Opcode.T_DOUBLE, 2);
+ primitiveTypes[7] = doubleType;
+
+ voidType = new CtPrimitiveType("void", 'V', "java.lang.Void",
+ null, null, Opcode.RETURN, 0, 0);
+ primitiveTypes[8] = voidType;
+ }
+
+ protected CtClass(String name) {
+ qualifiedName = name;
+ }
+
+ /**
+ * Converts the object to a string.
+ */
+ public String toString() {
+ StringBuffer buf = new StringBuffer(getClass().getName());
+ buf.append("@");
+ buf.append(Integer.toHexString(hashCode()));
+ buf.append("[");
+ extendToString(buf);
+ buf.append("]");
+ return buf.toString();
+ }
+
+ /**
+ * Implemented in subclasses to add to the {@link #toString()} result.
+ * Subclasses should put a space before each token added to the buffer.
+ */
+ protected void extendToString(StringBuffer buffer) {
+ buffer.append(getName());
+ }
+
+ /**
+ * Returns a <code>ClassPool</code> for this class.
+ */
+ public ClassPool getClassPool() { return null; }
+
+ /**
+ * Returns a class file for this class.
+ *
+ * <p>This method is not available if <code>isFrozen()</code>
+ * is true.
+ */
+ public ClassFile getClassFile() {
+ checkModify();
+ return getClassFile2();
+ }
+
+ /**
+ * Returns a class file for this class (read only).
+ * Normal applications do not need calling this method. Use
+ * <code>getClassFile()</code>.
+ *
+ * <p>The <code>ClassFile</code> object obtained by this method
+ * is read only. Changes to this object might not be reflected
+ * on a class file generated by <code>toBytecode()</code>,
+ * <code>toClass()</code>, etc.
+ *
+ * <p>This method is available even if <code>isFrozen()</code>
+ * is true. However, if the class is frozen, it might be also
+ * pruned.
+ *
+ * @see CtClass#getClassFile()
+ * @see CtClass#isFrozen()
+ * @see CtClass#prune()
+ */
+ public ClassFile getClassFile2() { return null; }
+
+ /**
+ * Undocumented method. Do not use; internal-use only.
+ */
+ public javassist.compiler.AccessorMaker getAccessorMaker() {
+ return null;
+ }
+
+ /**
+ * Returns the uniform resource locator (URL) of the class file.
+ */
+ public URL getURL() throws NotFoundException {
+ throw new NotFoundException(getName());
+ }
+
+ /**
+ * Returns true if the definition of the class has been modified.
+ */
+ public boolean isModified() { return false; }
+
+ /**
+ * Returns true if the class has been loaded or written out
+ * and thus it cannot be modified any more.
+ *
+ * @see #defrost()
+ * @see #detach()
+ */
+ public boolean isFrozen() { return true; }
+
+ /**
+ * Makes the class frozen.
+ *
+ * @see #isFrozen()
+ * @see #defrost()
+ * @since 3.6
+ */
+ public void freeze() {}
+
+ /* Note: this method is overridden by CtClassType
+ */
+ void checkModify() throws RuntimeException {
+ if (isFrozen())
+ throw new RuntimeException(getName() + " class is frozen");
+
+ // isModified() must return true after this method is invoked.
+ }
+
+ /**
+ * Defrosts the class so that the class can be modified again.
+ *
+ * <p>To avoid changes that will be never reflected,
+ * the class is frozen to be unmodifiable if it is loaded or
+ * written out. This method should be called only in a case
+ * that the class will be reloaded or written out later again.
+ *
+ * <p>If <code>defrost()</code> will be called later, pruning
+ * must be disallowed in advance.
+ *
+ * @see #isFrozen()
+ * @see #stopPruning(boolean)
+ * @see #detach()
+ */
+ public void defrost() {
+ throw new RuntimeException("cannot defrost " + getName());
+ }
+
+ /**
+ * Returns <code>true</code> if this object represents a primitive
+ * Java type: boolean, byte, char, short, int, long, float, double,
+ * or void.
+ */
+ public boolean isPrimitive() { return false; }
+
+ /**
+ * Returns <code>true</code> if this object represents an array type.
+ */
+ public boolean isArray() {
+ return false;
+ }
+
+ /**
+ * If this object represents an array, this method returns the component
+ * type of the array. Otherwise, it returns <code>null</code>.
+ */
+ public CtClass getComponentType() throws NotFoundException {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if this class extends or implements
+ * <code>clazz</code>. It also returns <code>true</code> if
+ * this class is the same as <code>clazz</code>.
+ */
+ public boolean subtypeOf(CtClass clazz) throws NotFoundException {
+ return this == clazz || getName().equals(clazz.getName());
+ }
+
+ /**
+ * Obtains the fully-qualified name of the class.
+ */
+ public String getName() { return qualifiedName; }
+
+ /**
+ * Obtains the not-qualified class name.
+ */
+ public final String getSimpleName() {
+ String qname = qualifiedName;
+ int index = qname.lastIndexOf('.');
+ if (index < 0)
+ return qname;
+ else
+ return qname.substring(index + 1);
+ }
+
+ /**
+ * Obtains the package name. It may be <code>null</code>.
+ */
+ public final String getPackageName() {
+ String qname = qualifiedName;
+ int index = qname.lastIndexOf('.');
+ if (index < 0)
+ return null;
+ else
+ return qname.substring(0, index);
+ }
+
+ /**
+ * Sets the class name
+ *
+ * @param name fully-qualified name
+ */
+ public void setName(String name) {
+ checkModify();
+ if (name != null)
+ qualifiedName = name;
+ }
+
+ /**
+ * Substitutes <code>newName</code> for all occurrences of a class
+ * name <code>oldName</code> in the class file.
+ *
+ * @param oldName replaced class name
+ * @param newName substituted class name
+ */
+ public void replaceClassName(String oldName, String newName) {
+ checkModify();
+ }
+
+ /**
+ * Changes class names appearing in the class file according to the
+ * given <code>map</code>.
+ *
+ * <p>All the class names appearing in the class file are tested
+ * with <code>map</code> to determine whether each class name is
+ * replaced or not. Thus this method can be used for collecting
+ * all the class names in the class file. To do that, first define
+ * a subclass of <code>ClassMap</code> so that <code>get()</code>
+ * records all the given parameters. Then, make an instance of
+ * that subclass as an empty hash-table. Finally, pass that instance
+ * to this method. After this method finishes, that instance would
+ * contain all the class names appearing in the class file.
+ *
+ * @param map the hashtable associating replaced class names
+ * with substituted names.
+ */
+ public void replaceClassName(ClassMap map) {
+ checkModify();
+ }
+
+ /**
+ * Returns a collection of the names of all the classes
+ * referenced in this class.
+ * That collection includes the name of this class.
+ *
+ * <p>This method may return <code>null</code>.
+ */
+ public synchronized Collection getRefClasses() {
+ ClassFile cf = getClassFile2();
+ if (cf != null) {
+ ClassMap cm = new ClassMap() {
+ public void put(String oldname, String newname) {
+ put0(oldname, newname);
+ }
+
+ public Object get(Object jvmClassName) {
+ String n = toJavaName((String)jvmClassName);
+ put0(n, n);
+ return null;
+ }
+
+ public void fix(String name) {}
+ };
+ cf.renameClass(cm);
+ return cm.values();
+ }
+ else
+ return null;
+ }
+
+ /**
+ * Determines whether this object represents a class or an interface.
+ * It returns <code>true</code> if this object represents an interface.
+ */
+ public boolean isInterface() {
+ return false;
+ }
+
+ /**
+ * Determines whether this object represents an annotation type.
+ * It returns <code>true</code> if this object represents an annotation type.
+ *
+ * @since 3.2
+ */
+ public boolean isAnnotation() {
+ return false;
+ }
+
+ /**
+ * Determines whether this object represents an enum.
+ * It returns <code>true</code> if this object represents an enum.
+ *
+ * @since 3.2
+ */
+ public boolean isEnum() {
+ return false;
+ }
+
+ /**
+ * Returns the modifiers for this class, encoded in an integer.
+ * For decoding, use <code>javassist.Modifier</code>.
+ *
+ * <p>If the class is a static nested class (a.k.a. static inner class),
+ * the returned modifiers include <code>Modifier.STATIC</code>.
+ *
+ * @see Modifier
+ */
+ public int getModifiers() {
+ return 0;
+ }
+
+ /**
+ * Returns true if the class has the specified annotation class.
+ *
+ * @param clz the annotation class.
+ * @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
+ * @since 3.11
+ */
+ public boolean hasAnnotation(Class clz) {
+ return false;
+ }
+
+ /**
+ * Returns the annotation if the class has the specified annotation class.
+ * For example, if an annotation <code>@Author</code> is associated
+ * with this class, an <code>Author</code> object is returned.
+ * The member values can be obtained by calling methods on
+ * the <code>Author</code> object.
+ *
+ * @param clz the annotation class.
+ * @return the annotation if found, otherwise <code>null</code>.
+ * @since 3.11
+ */
+ public Object getAnnotation(Class clz) throws ClassNotFoundException {
+ return null;
+ }
+
+ /**
+ * Returns the annotations associated with this class.
+ * For example, if an annotation <code>@Author</code> is associated
+ * with this class, the returned array contains an <code>Author</code>
+ * object. The member values can be obtained by calling methods on
+ * the <code>Author</code> object.
+ *
+ * @return an array of annotation-type objects.
+ * @see CtMember#getAnnotations()
+ * @since 3.1
+ */
+ public Object[] getAnnotations() throws ClassNotFoundException {
+ return new Object[0];
+ }
+
+ /**
+ * Returns the annotations associated with this class.
+ * This method is equivalent to <code>getAnnotations()</code>
+ * except that, if any annotations are not on the classpath,
+ * they are not included in the returned array.
+ *
+ * @return an array of annotation-type objects.
+ * @see #getAnnotations()
+ * @see CtMember#getAvailableAnnotations()
+ * @since 3.3
+ */
+ public Object[] getAvailableAnnotations(){
+ return new Object[0];
+ }
+
+ /**
+ * Returns an array of nested classes declared in the class.
+ * Nested classes are inner classes, anonymous classes, local classes,
+ * and static nested classes.
+ *
+ * @since 3.2
+ */
+ public CtClass[] getNestedClasses() throws NotFoundException {
+ return new CtClass[0];
+ }
+
+ /**
+ * Sets the modifiers.
+ *
+ * <p>If the class is a nested class, this method also modifies
+ * the class declaring that nested class (i.e. the enclosing
+ * class is modified).
+ *
+ * @param mod modifiers encoded by
+ * <code>javassist.Modifier</code>
+ * @see Modifier
+ */
+ public void setModifiers(int mod) {
+ checkModify();
+ }
+
+ /**
+ * Determines whether the class directly or indirectly extends
+ * the given class. If this class extends a class A and
+ * the class A extends a class B, then subclassof(B) returns true.
+ *
+ * <p>This method returns true if the given class is identical to
+ * the class represented by this object.
+ */
+ public boolean subclassOf(CtClass superclass) {
+ return false;
+ }
+
+ /**
+ * Obtains the class object representing the superclass of the
+ * class.
+ * It returns null if this object represents the
+ * <code>java.lang.Object</code> class and thus it does not have
+ * the super class.
+ *
+ * <p>If this object represents an interface, this method
+ * always returns the <code>java.lang.Object</code> class.
+ * To obtain the super interfaces
+ * extended by that interface, call <code>getInterfaces()</code>.
+ */
+ public CtClass getSuperclass() throws NotFoundException {
+ return null;
+ }
+
+ /**
+ * Changes a super class unless this object represents an interface.
+ * The new super class must be compatible with the old one; for example,
+ * it should inherit from the old super class.
+ *
+ * <p>If this object represents an interface, this method is equivalent
+ * to <code>addInterface()</code>; it appends <code>clazz</code> to
+ * the list of the super interfaces extended by that interface.
+ * Note that an interface can extend multiple super interfaces.
+ *
+ * @see #replaceClassName(String, String)
+ * @see #replaceClassName(ClassMap)
+ */
+ public void setSuperclass(CtClass clazz) throws CannotCompileException {
+ checkModify();
+ }
+
+ /**
+ * Obtains the class objects representing the interfaces implemented
+ * by the class or, if this object represents an interface, the interfaces
+ * extended by that interface.
+ */
+ public CtClass[] getInterfaces() throws NotFoundException {
+ return new CtClass[0];
+ }
+
+ /**
+ * Sets implemented interfaces. If this object represents an interface,
+ * this method sets the interfaces extended by that interface.
+ *
+ * @param list a list of the <code>CtClass</code> objects
+ * representing interfaces, or
+ * <code>null</code> if the class implements
+ * no interfaces.
+ */
+ public void setInterfaces(CtClass[] list) {
+ checkModify();
+ }
+
+ /**
+ * Adds an interface.
+ *
+ * @param anInterface the added interface.
+ */
+ public void addInterface(CtClass anInterface) {
+ checkModify();
+ }
+
+ /**
+ * If this class is a member class or interface of another class,
+ * then the class enclosing this class is returned.
+ *
+ * @return null if this class is a top-level class or an anonymous class.
+ */
+ public CtClass getDeclaringClass() throws NotFoundException {
+ return null;
+ }
+
+ /**
+ * Returns the immediately enclosing method of this class.
+ * This method works only with JDK 1.5 or later.
+ *
+ * @return null if this class is not a local class or an anonymous
+ * class.
+ */
+ public CtMethod getEnclosingMethod() throws NotFoundException {
+ return null;
+ }
+
+ /**
+ * Makes a new public nested class. If this method is called,
+ * the <code>CtClass</code>, which encloses the nested class, is modified
+ * since a class file includes a list of nested classes.
+ *
+ * <p>The current implementation only supports a static nested class.
+ * <code>isStatic</code> must be true.
+ *
+ * @param name the simple name of the nested class.
+ * @param isStatic true if the nested class is static.
+ */
+ public CtClass makeNestedClass(String name, boolean isStatic) {
+ throw new RuntimeException(getName() + " is not a class");
+ }
+
+ /**
+ * Returns an array containing <code>CtField</code> objects
+ * representing all the non-private fields of the class.
+ * That array includes non-private fields inherited from the
+ * superclasses.
+ */
+ public CtField[] getFields() { return new CtField[0]; }
+
+ /**
+ * Returns the field with the specified name. The returned field
+ * may be a private field declared in a super class or interface.
+ */
+ public CtField getField(String name) throws NotFoundException {
+ throw new NotFoundException(name);
+ }
+
+ /**
+ * @return null if the specified field is not found.
+ */
+ CtField getField2(String name) { return null; }
+
+ /**
+ * Gets all the fields declared in the class. The inherited fields
+ * are not included.
+ *
+ * <p>Note: the result does not include inherited fields.
+ */
+ public CtField[] getDeclaredFields() { return new CtField[0]; }
+
+ /**
+ * Retrieves the field with the specified name among the fields
+ * declared in the class.
+ *
+ * <p>Note: this method does not search the superclasses.
+ */
+ public CtField getDeclaredField(String name) throws NotFoundException {
+ throw new NotFoundException(name);
+ }
+
+ /**
+ * Gets all the constructors and methods declared in the class.
+ */
+ public CtBehavior[] getDeclaredBehaviors() {
+ return new CtBehavior[0];
+ }
+
+ /**
+ * Returns an array containing <code>CtConstructor</code> objects
+ * representing all the non-private constructors of the class.
+ */
+ public CtConstructor[] getConstructors() {
+ return new CtConstructor[0];
+ }
+
+ /**
+ * Returns the constructor with the given signature,
+ * which is represented by a character string
+ * called method descriptor.
+ * For details of the method descriptor, see the JVM specification
+ * or <code>javassist.bytecode.Descriptor</code>.
+ *
+ * @param desc method descriptor
+ * @see javassist.bytecode.Descriptor
+ */
+ public CtConstructor getConstructor(String desc)
+ throws NotFoundException
+ {
+ throw new NotFoundException("no such a constructor");
+ }
+
+ /**
+ * Gets all the constructors declared in the class.
+ *
+ * @see javassist.CtConstructor
+ */
+ public CtConstructor[] getDeclaredConstructors() {
+ return new CtConstructor[0];
+ }
+
+ /**
+ * Returns a constructor receiving the specified parameters.
+ *
+ * @param params parameter types.
+ */
+ public CtConstructor getDeclaredConstructor(CtClass[] params)
+ throws NotFoundException
+ {
+ String desc = Descriptor.ofConstructor(params);
+ return getConstructor(desc);
+ }
+
+ /**
+ * Gets the class initializer (static constructor)
+ * declared in the class.
+ * This method returns <code>null</code> if
+ * no class initializer is not declared.
+ *
+ * @see #makeClassInitializer()
+ * @see javassist.CtConstructor
+ */
+ public CtConstructor getClassInitializer() {
+ return null;
+ }
+
+ /**
+ * Returns an array containing <code>CtMethod</code> objects
+ * representing all the non-private methods of the class.
+ * That array includes non-private methods inherited from the
+ * superclasses.
+ */
+ public CtMethod[] getMethods() {
+ return new CtMethod[0];
+ }
+
+ /**
+ * Returns the method with the given name and signature.
+ * The returned method may be declared in a super class.
+ * The method signature is represented by a character string
+ * called method descriptor,
+ * which is defined in the JVM specification.
+ *
+ * @param name method name
+ * @param desc method descriptor
+ * @see CtBehavior#getSignature()
+ * @see javassist.bytecode.Descriptor
+ */
+ public CtMethod getMethod(String name, String desc)
+ throws NotFoundException
+ {
+ throw new NotFoundException(name);
+ }
+
+ /**
+ * Gets all methods declared in the class. The inherited methods
+ * are not included.
+ *
+ * @see javassist.CtMethod
+ */
+ public CtMethod[] getDeclaredMethods() {
+ return new CtMethod[0];
+ }
+
+ /**
+ * Retrieves the method with the specified name and parameter types
+ * among the methods declared in the class.
+ *
+ * <p>Note: this method does not search the superclasses.
+ *
+ * @param name method name
+ * @param params parameter types
+ * @see javassist.CtMethod
+ */
+ public CtMethod getDeclaredMethod(String name, CtClass[] params)
+ throws NotFoundException
+ {
+ throw new NotFoundException(name);
+ }
+
+ /**
+ * Retrieves the method with the specified name among the methods
+ * declared in the class. If there are multiple methods with
+ * the specified name, then this method returns one of them.
+ *
+ * <p>Note: this method does not search the superclasses.
+ *
+ * @see javassist.CtMethod
+ */
+ public CtMethod getDeclaredMethod(String name) throws NotFoundException {
+ throw new NotFoundException(name);
+ }
+
+ /**
+ * Makes an empty class initializer (static constructor).
+ * If the class already includes a class initializer,
+ * this method returns it.
+ *
+ * @see #getClassInitializer()
+ */
+ public CtConstructor makeClassInitializer()
+ throws CannotCompileException
+ {
+ throw new CannotCompileException("not a class");
+ }
+
+ /**
+ * Adds a constructor. To add a class initializer (static constructor),
+ * call <code>makeClassInitializer()</code>.
+ *
+ * @see #makeClassInitializer()
+ */
+ public void addConstructor(CtConstructor c)
+ throws CannotCompileException
+ {
+ checkModify();
+ }
+
+ /**
+ * Removes a constructor declared in this class.
+ *
+ * @param c removed constructor.
+ * @throws NotFoundException if the constructor is not found.
+ */
+ public void removeConstructor(CtConstructor c) throws NotFoundException {
+ checkModify();
+ }
+
+ /**
+ * Adds a method.
+ */
+ public void addMethod(CtMethod m) throws CannotCompileException {
+ checkModify();
+ }
+
+ /**
+ * Removes a method declared in this class.
+ *
+ * @param m removed method.
+ * @throws NotFoundException if the method is not found.
+ */
+ public void removeMethod(CtMethod m) throws NotFoundException {
+ checkModify();
+ }
+
+ /**
+ * Adds a field.
+ *
+ * <p>The <code>CtField</code> belonging to another
+ * <code>CtClass</code> cannot be directly added to this class.
+ * Only a field created for this class can be added.
+ *
+ * @see javassist.CtField#CtField(CtField,CtClass)
+ */
+ public void addField(CtField f) throws CannotCompileException {
+ addField(f, (CtField.Initializer)null);
+ }
+
+ /**
+ * Adds a field with an initial value.
+ *
+ * <p>The <code>CtField</code> belonging to another
+ * <code>CtClass</code> cannot be directly added to this class.
+ * Only a field created for this class can be added.
+ *
+ * <p>The initial value is given as an expression written in Java.
+ * Any regular Java expression can be used for specifying the initial
+ * value. The followings are examples.
+ *
+ * <ul><pre>
+ * cc.addField(f, "0") // the initial value is 0.
+ * cc.addField(f, "i + 1") // i + 1.
+ * cc.addField(f, "new Point()"); // a Point object.
+ * </pre></ul>
+ *
+ * <p>Here, the type of variable <code>cc</code> is <code>CtClass</code>.
+ * The type of <code>f</code> is <code>CtField</code>.
+ *
+ * <p>Note: do not change the modifier of the field
+ * (in particular, do not add or remove <code>static</code>
+ * to/from the modifier)
+ * after it is added to the class by <code>addField()</code>.
+ *
+ * @param init an expression for the initial value.
+ *
+ * @see javassist.CtField.Initializer#byExpr(String)
+ * @see javassist.CtField#CtField(CtField,CtClass)
+ */
+ public void addField(CtField f, String init)
+ throws CannotCompileException
+ {
+ checkModify();
+ }
+
+ /**
+ * Adds a field with an initial value.
+ *
+ * <p>The <code>CtField</code> belonging to another
+ * <code>CtClass</code> cannot be directly added to this class.
+ * Only a field created for this class can be added.
+ *
+ * <p>For example,
+ *
+ * <ul><pre>
+ * CtClass cc = ...;
+ * addField(new CtField(CtClass.intType, "i", cc),
+ * CtField.Initializer.constant(1));
+ * </pre></ul>
+ *
+ * <p>This code adds an <code>int</code> field named "i". The
+ * initial value of this field is 1.
+ *
+ * @param init specifies the initial value of the field.
+ *
+ * @see javassist.CtField#CtField(CtField,CtClass)
+ */
+ public void addField(CtField f, CtField.Initializer init)
+ throws CannotCompileException
+ {
+ checkModify();
+ }
+
+ /**
+ * Removes a field declared in this class.
+ *
+ * @param f removed field.
+ * @throws NotFoundException if the field is not found.
+ */
+ public void removeField(CtField f) throws NotFoundException {
+ checkModify();
+ }
+
+ /**
+ * Obtains an attribute with the given name.
+ * If that attribute is not found in the class file, this
+ * method returns null.
+ *
+ * <p>This is a convenient method mainly for obtaining
+ * a user-defined attribute. For dealing with attributes, see the
+ * <code>javassist.bytecode</code> package. For example, the following
+ * expression returns all the attributes of a class file.
+ *
+ * <ul><pre>
+ * getClassFile().getAttributes()
+ * </pre></ul>
+ *
+ * @param name attribute name
+ * @see javassist.bytecode.AttributeInfo
+ */
+ public byte[] getAttribute(String name) {
+ return null;
+ }
+
+ /**
+ * Adds a named attribute.
+ * An arbitrary data (smaller than 64Kb) can be saved in the class
+ * file. Some attribute name are reserved by the JVM.
+ * The attributes with the non-reserved names are ignored when a
+ * class file is loaded into the JVM.
+ * If there is already an attribute with
+ * the same name, this method substitutes the new one for it.
+ *
+ * <p>This is a convenient method mainly for adding
+ * a user-defined attribute. For dealing with attributes, see the
+ * <code>javassist.bytecode</code> package. For example, the following
+ * expression adds an attribute <code>info</code> to a class file.
+ *
+ * <ul><pre>
+ * getClassFile().addAttribute(info)
+ * </pre></ul>
+ *
+ * @param name attribute name
+ * @param data attribute value
+ * @see javassist.bytecode.AttributeInfo
+ */
+ public void setAttribute(String name, byte[] data) {
+ checkModify();
+ }
+
+ /**
+ * Applies the given converter to all methods and constructors
+ * declared in the class. This method calls <code>instrument()</code>
+ * on every <code>CtMethod</code> and <code>CtConstructor</code> object
+ * in the class.
+ *
+ * @param converter specifies how to modify.
+ */
+ public void instrument(CodeConverter converter)
+ throws CannotCompileException
+ {
+ checkModify();
+ }
+
+ /**
+ * Modifies the bodies of all methods and constructors
+ * declared in the class. This method calls <code>instrument()</code>
+ * on every <code>CtMethod</code> and <code>CtConstructor</code> object
+ * in the class.
+ *
+ * @param editor specifies how to modify.
+ */
+ public void instrument(ExprEditor editor)
+ throws CannotCompileException
+ {
+ checkModify();
+ }
+
+ /**
+ * Converts this class to a <code>java.lang.Class</code> object.
+ * Once this method is called, further modifications are not
+ * allowed any more.
+ * To load the class, this method uses the context class loader
+ * of the current thread. If the program is running on some application
+ * server, the context class loader might be inappropriate to load the
+ * class.
+ *
+ * <p>This method is provided for convenience. If you need more
+ * complex functionality, you should write your own class loader.
+ *
+ * <p>Note: this method calls <code>toClass()</code>
+ * in <code>ClassPool</code>.
+ *
+ * <p><b>Warining:</b> A Class object returned by this method may not
+ * work with a security manager or a signed jar file because a
+ * protection domain is not specified.
+ *
+ * @see #toClass(java.lang.ClassLoader,ProtectionDomain)
+ * @see ClassPool#toClass(CtClass)
+ */
+ public Class toClass() throws CannotCompileException {
+ return getClassPool().toClass(this);
+ }
+
+ /**
+ * Converts this class to a <code>java.lang.Class</code> object.
+ * Once this method is called, further modifications are not allowed
+ * any more.
+ *
+ * <p>The class file represented by this <code>CtClass</code> is
+ * loaded by the given class loader to construct a
+ * <code>java.lang.Class</code> object. Since a private method
+ * on the class loader is invoked through the reflection API,
+ * the caller must have permissions to do that.
+ *
+ * <p>An easy way to obtain <code>ProtectionDomain</code> object is
+ * to call <code>getProtectionDomain()</code>
+ * in <code>java.lang.Class</code>. It returns the domain that
+ * the class belongs to.
+ *
+ * <p>This method is provided for convenience. If you need more
+ * complex functionality, you should write your own class loader.
+ *
+ * <p>Note: this method calls <code>toClass()</code>
+ * in <code>ClassPool</code>.
+ *
+ * @param loader the class loader used to load this class.
+ * If it is null, the class loader returned by
+ * {@link ClassPool#getClassLoader()} is used.
+ * @param domain the protection domain that the class belongs to.
+ * If it is null, the default domain created
+ * by <code>java.lang.ClassLoader</code> is used.
+ * @see ClassPool#toClass(CtClass,java.lang.ClassLoader)
+ * @since 3.3
+ */
+ public Class toClass(ClassLoader loader, ProtectionDomain domain)
+ throws CannotCompileException
+ {
+ ClassPool cp = getClassPool();
+ if (loader == null)
+ loader = cp.getClassLoader();
+
+ return cp.toClass(this, loader, domain);
+ }
+
+ /**
+ * Converts this class to a <code>java.lang.Class</code> object.
+ *
+ * <p><b>Warining:</b> A Class object returned by this method may not
+ * work with a security manager or a signed jar file because a
+ * protection domain is not specified.
+ *
+ * @deprecated Replaced by {@link #toClass(ClassLoader,ProtectionDomain)}
+ */
+ public final Class toClass(ClassLoader loader)
+ throws CannotCompileException
+ {
+ return getClassPool().toClass(this, loader);
+ }
+
+ /**
+ * Removes this <code>CtClass</code> object from the
+ * <code>ClassPool</code>.
+ * After this method is called, any method cannot be called on the
+ * removed <code>CtClass</code> object.
+ *
+ * <p>If <code>get()</code> in <code>ClassPool</code> is called
+ * with the name of the removed method,
+ * the <code>ClassPool</code> will read the class file again
+ * and constructs another <code>CtClass</code> object representing
+ * the same class.
+ */
+ public void detach() {
+ ClassPool cp = getClassPool();
+ CtClass obj = cp.removeCached(getName());
+ if (obj != this)
+ cp.cacheCtClass(getName(), obj, false);
+ }
+
+ /**
+ * Disallows (or allows) automatically pruning this <code>CtClass</code>
+ * object.
+ *
+ * <p>
+ * Javassist can automatically prune a <code>CtClass</code> object
+ * when <code>toBytecode()</code> (or <code>toClass()</code>,
+ * <code>writeFile()</code>) is called.
+ * Since a <code>ClassPool</code> holds all instances of <code>CtClass</code>
+ * even after <code>toBytecode()</code> (or <code>toClass()</code>,
+ * <code>writeFile()</code>) is called, pruning may significantly
+ * save memory consumption.
+ *
+ * <p>If <code>ClassPool.doPruning</code> is true, the automatic pruning
+ * is on by default. Otherwise, it is off. The default value of
+ * <code>ClassPool.doPruning</code> is false.
+ *
+ * @param stop disallow pruning if true. Otherwise, allow.
+ * @return the previous status of pruning. true if pruning is already stopped.
+ *
+ * @see #detach()
+ * @see #prune()
+ * @see ClassPool#doPruning
+ */
+ public boolean stopPruning(boolean stop) { return true; }
+
+ /**
+ * Discards unnecessary attributes, in particular,
+ * <code>CodeAttribute</code>s (method bodies) of the class,
+ * to minimize the memory footprint.
+ * After calling this method, the class is read only.
+ * It cannot be modified any more.
+ * Furthermore, <code>toBytecode()</code>,
+ * <code>writeFile()</code>, <code>toClass()</code>,
+ * or <code>instrument()</code> cannot be called.
+ * However, the method names and signatures in the class etc.
+ * are still accessible.
+ *
+ * <p><code>toBytecode()</code>, <code>writeFile()</code>, and
+ * <code>toClass()</code> internally call this method if
+ * automatic pruning is on.
+ *
+ * <p>According to some experiments, pruning does not really reduce
+ * memory consumption. Only about 20%. Since pruning takes time,
+ * it might not pay off. So the automatic pruning is off by default.
+ *
+ * @see #stopPruning(boolean)
+ * @see #detach()
+ * @see ClassPool#doPruning
+ *
+ * @see #toBytecode()
+ * @see #toClass()
+ * @see #writeFile()
+ * @see #instrument(CodeConverter)
+ * @see #instrument(ExprEditor)
+ */
+ public void prune() {}
+
+ /* Called by get() in ClassPool.
+ * CtClassType overrides this method.
+ */
+ void incGetCounter() {}
+
+ /**
+ * If this method is called, the class file will be
+ * rebuilt when it is finally generated by
+ * <code>toBytecode()</code> and <code>writeFile()</code>.
+ * For a performance reason, the symbol table of the
+ * class file may contain unused entries, for example,
+ * after a method or a filed is deleted.
+ * This method
+ * removes those unused entries. This removal will
+ * minimize the size of the class file.
+ *
+ * @since 3.8.1
+ */
+ public void rebuildClassFile() {}
+
+ /**
+ * Converts this class to a class file.
+ * Once this method is called, further modifications are not
+ * possible any more.
+ *
+ * @return the contents of the class file.
+ */
+ public byte[] toBytecode() throws IOException, CannotCompileException {
+ ByteArrayOutputStream barray = new ByteArrayOutputStream();
+ DataOutputStream out = new DataOutputStream(barray);
+ try {
+ toBytecode(out);
+ }
+ finally {
+ out.close();
+ }
+
+ return barray.toByteArray();
+ }
+
+ /**
+ * Writes a class file represented by this <code>CtClass</code>
+ * object in the current directory.
+ * Once this method is called, further modifications are not
+ * possible any more.
+ *
+ * @see #debugWriteFile()
+ */
+ public void writeFile()
+ throws NotFoundException, IOException, CannotCompileException
+ {
+ writeFile(".");
+ }
+
+ /**
+ * Writes a class file represented by this <code>CtClass</code>
+ * object on a local disk.
+ * Once this method is called, further modifications are not
+ * possible any more.
+ *
+ * @param directoryName it must end without a directory separator.
+ * @see #debugWriteFile(String)
+ */
+ public void writeFile(String directoryName)
+ throws CannotCompileException, IOException
+ {
+ String classname = getName();
+ String filename = directoryName + File.separatorChar
+ + classname.replace('.', File.separatorChar) + ".class";
+ int pos = filename.lastIndexOf(File.separatorChar);
+ if (pos > 0) {
+ String dir = filename.substring(0, pos);
+ if (!dir.equals("."))
+ new File(dir).mkdirs();
+ }
+
+ DataOutputStream out
+ = new DataOutputStream(new BufferedOutputStream(
+ new DelayedFileOutputStream(filename)));
+ try {
+ toBytecode(out);
+ }
+ finally {
+ out.close();
+ }
+ }
+
+ /**
+ * Writes a class file as <code>writeFile()</code> does although this
+ * method does not prune or freeze the class after writing the class
+ * file. Note that, once <code>writeFile()</code> or <code>toBytecode()</code>
+ * is called, it cannot be called again since the class is pruned and frozen.
+ * This method would be useful for debugging.
+ */
+ public void debugWriteFile() {
+ debugWriteFile(".");
+ }
+
+ /**
+ * Writes a class file as <code>writeFile()</code> does although this
+ * method does not prune or freeze the class after writing the class
+ * file. Note that, once <code>writeFile()</code> or <code>toBytecode()</code>
+ * is called, it cannot be called again since the class is pruned and frozen.
+ * This method would be useful for debugging.
+ *
+ * @param directoryName it must end without a directory separator.
+ */
+ public void debugWriteFile(String directoryName) {
+ try {
+ boolean p = stopPruning(true);
+ writeFile(directoryName);
+ defrost();
+ stopPruning(p);
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ static class DelayedFileOutputStream extends OutputStream {
+ private FileOutputStream file;
+ private String filename;
+
+ DelayedFileOutputStream(String name) {
+ file = null;
+ filename = name;
+ }
+
+ private void init() throws IOException {
+ if (file == null)
+ file = new FileOutputStream(filename);
+ }
+
+ public void write(int b) throws IOException {
+ init();
+ file.write(b);
+ }
+
+ public void write(byte[] b) throws IOException {
+ init();
+ file.write(b);
+ }
+
+ public void write(byte[] b, int off, int len) throws IOException {
+ init();
+ file.write(b, off, len);
+
+ }
+
+ public void flush() throws IOException {
+ init();
+ file.flush();
+ }
+
+ public void close() throws IOException {
+ init();
+ file.close();
+ }
+ }
+
+ /**
+ * Converts this class to a class file.
+ * Once this method is called, further modifications are not
+ * possible any more.
+ *
+ * <p>This method dose not close the output stream in the end.
+ *
+ * @param out the output stream that a class file is written to.
+ */
+ public void toBytecode(DataOutputStream out)
+ throws CannotCompileException, IOException
+ {
+ throw new CannotCompileException("not a class");
+ }
+
+ /**
+ * Makes a unique member name. This method guarantees that
+ * the returned name is not used as a prefix of any methods
+ * or fields visible in this class.
+ * If the returned name is XYZ, then any method or field names
+ * in this class do not start with XYZ.
+ *
+ * @param prefix the prefix of the member name.
+ */
+ public String makeUniqueName(String prefix) {
+ throw new RuntimeException("not available in " + getName());
+ }
+
+ /* Invoked from ClassPool#compress().
+ * This method is overridden by CtClassType.
+ */
+ void compress() {}
+}
Deleted: tags/rel_3_12_0_ga/src/main/javassist/bytecode/CodeAttribute.java
===================================================================
--- trunk/src/main/javassist/bytecode/CodeAttribute.java 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/src/main/javassist/bytecode/CodeAttribute.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,581 +0,0 @@
-/*
- * Javassist, a Java-bytecode translator toolkit.
- * Copyright (C) 1999-2007 Shigeru Chiba. All Rights Reserved.
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. Alternatively, the contents of this file may be used under
- * the terms of the GNU Lesser General Public License Version 2.1 or later.
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- */
-
-package javassist.bytecode;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * <code>Code_attribute</code>.
- *
- * <p>To browse the <code>code</code> field of
- * a <code>Code_attribute</code> structure,
- * use <code>CodeIterator</code>.
- *
- * @see CodeIterator
- */
-public class CodeAttribute extends AttributeInfo implements Opcode {
- /**
- * The name of this attribute <code>"Code"</code>.
- */
- public static final String tag = "Code";
-
- // code[] is stored in AttributeInfo.info.
-
- private int maxStack;
- private int maxLocals;
- private ExceptionTable exceptions;
- private LinkedList attributes;
-
- /**
- * Constructs a <code>Code_attribute</code>.
- *
- * @param cp constant pool table
- * @param stack <code>max_stack</code>
- * @param locals <code>max_locals</code>
- * @param code <code>code[]</code>
- * @param etable <code>exception_table[]</code>
- */
- public CodeAttribute(ConstPool cp, int stack, int locals, byte[] code,
- ExceptionTable etable)
- {
- super(cp, tag);
- maxStack = stack;
- maxLocals = locals;
- info = code;
- exceptions = etable;
- attributes = new LinkedList();
- }
-
- /**
- * Constructs a copy of <code>Code_attribute</code>.
- * Specified class names are replaced during the copy.
- *
- * @param cp constant pool table.
- * @param src source Code attribute.
- * @param classnames pairs of replaced and substituted
- * class names.
- */
- private CodeAttribute(ConstPool cp, CodeAttribute src, Map classnames)
- throws BadBytecode
- {
- super(cp, tag);
-
- maxStack = src.getMaxStack();
- maxLocals = src.getMaxLocals();
- exceptions = src.getExceptionTable().copy(cp, classnames);
- attributes = new LinkedList();
- List src_attr = src.getAttributes();
- int num = src_attr.size();
- for (int i = 0; i < num; ++i) {
- AttributeInfo ai = (AttributeInfo)src_attr.get(i);
- attributes.add(ai.copy(cp, classnames));
- }
-
- info = src.copyCode(cp, classnames, exceptions, this);
- }
-
- CodeAttribute(ConstPool cp, int name_id, DataInputStream in)
- throws IOException
- {
- super(cp, name_id, (byte[])null);
- int attr_len = in.readInt();
-
- maxStack = in.readUnsignedShort();
- maxLocals = in.readUnsignedShort();
-
- int code_len = in.readInt();
- info = new byte[code_len];
- in.readFully(info);
-
- exceptions = new ExceptionTable(cp, in);
-
- attributes = new LinkedList();
- int num = in.readUnsignedShort();
- for (int i = 0; i < num; ++i)
- attributes.add(AttributeInfo.read(cp, in));
- }
-
- /**
- * Makes a copy. Class names are replaced according to the
- * given <code>Map</code> object.
- *
- * @param newCp the constant pool table used by the new copy.
- * @param classnames pairs of replaced and substituted
- * class names.
- * @exception RuntimeCopyException if a <code>BadBytecode</code>
- * exception is thrown, it is
- * converted into
- * <code>RuntimeCopyException</code>.
- *
- * @return <code>CodeAttribute</code> object.
- */
- public AttributeInfo copy(ConstPool newCp, Map classnames)
- throws RuntimeCopyException
- {
- try {
- return new CodeAttribute(newCp, this, classnames);
- }
- catch (BadBytecode e) {
- throw new RuntimeCopyException("bad bytecode. fatal?");
- }
- }
-
- /**
- * An exception that may be thrown by <code>copy()</code>
- * in <code>CodeAttribute</code>.
- */
- public static class RuntimeCopyException extends RuntimeException {
- /**
- * Constructs an exception.
- */
- public RuntimeCopyException(String s) {
- super(s);
- }
- }
-
- /**
- * Returns the length of this <code>attribute_info</code>
- * structure.
- * The returned value is <code>attribute_length + 6</code>.
- */
- public int length() {
- return 18 + info.length + exceptions.size() * 8
- + AttributeInfo.getLength(attributes);
- }
-
- void write(DataOutputStream out) throws IOException {
- out.writeShort(name); // attribute_name_index
- out.writeInt(length() - 6); // attribute_length
- out.writeShort(maxStack); // max_stack
- out.writeShort(maxLocals); // max_locals
- out.writeInt(info.length); // code_length
- out.write(info); // code
- exceptions.write(out);
- out.writeShort(attributes.size()); // attributes_count
- AttributeInfo.writeAll(attributes, out); // attributes
- }
-
- /**
- * This method is not available.
- *
- * @throws java.lang.UnsupportedOperationException always thrown.
- */
- public byte[] get() {
- throw new UnsupportedOperationException("CodeAttribute.get()");
- }
-
- /**
- * This method is not available.
- *
- * @throws java.lang.UnsupportedOperationException always thrown.
- */
- public void set(byte[] newinfo) {
- throw new UnsupportedOperationException("CodeAttribute.set()");
- }
-
- void renameClass(String oldname, String newname) {
- AttributeInfo.renameClass(attributes, oldname, newname);
- }
-
- void renameClass(Map classnames) {
- AttributeInfo.renameClass(attributes, classnames);
- }
-
- /**
- * Returns the name of the class declaring the method including
- * this code attribute.
- */
- public String getDeclaringClass() {
- ConstPool cp = getConstPool();
- return cp.getClassName();
- }
-
- /**
- * Returns <code>max_stack</code>.
- */
- public int getMaxStack() {
- return maxStack;
- }
-
- /**
- * Sets <code>max_stack</code>.
- */
- public void setMaxStack(int value) {
- maxStack = value;
- }
-
- /**
- * Computes the maximum stack size and sets <code>max_stack</code>
- * to the computed size.
- *
- * @throws BadBytecode if this method fails in computing.
- * @return the newly computed value of <code>max_stack</code>
- */
- public int computeMaxStack() throws BadBytecode {
- maxStack = new CodeAnalyzer(this).computeMaxStack();
- return maxStack;
- }
-
- /**
- * Returns <code>max_locals</code>.
- */
- public int getMaxLocals() {
- return maxLocals;
- }
-
- /**
- * Sets <code>max_locals</code>.
- */
- public void setMaxLocals(int value) {
- maxLocals = value;
- }
-
- /**
- * Returns <code>code_length</code>.
- */
- public int getCodeLength() {
- return info.length;
- }
-
- /**
- * Returns <code>code[]</code>.
- */
- public byte[] getCode() {
- return info;
- }
-
- /**
- * Sets <code>code[]</code>.
- */
- void setCode(byte[] newinfo) { super.set(newinfo); }
-
- /**
- * Makes a new iterator for reading this code attribute.
- */
- public CodeIterator iterator() {
- return new CodeIterator(this);
- }
-
- /**
- * Returns <code>exception_table[]</code>.
- */
- public ExceptionTable getExceptionTable() { return exceptions; }
-
- /**
- * Returns <code>attributes[]</code>.
- * It returns a list of <code>AttributeInfo</code>.
- * A new element can be added to the returned list
- * and an existing element can be removed from the list.
- *
- * @see AttributeInfo
- */
- public List getAttributes() { return attributes; }
-
- /**
- * Returns the attribute with the specified name.
- * If it is not found, this method returns null.
- *
- * @param name attribute name
- * @return an <code>AttributeInfo</code> object or null.
- */
- public AttributeInfo getAttribute(String name) {
- return AttributeInfo.lookup(attributes, name);
- }
-
- /**
- * Adds a stack map table. If another copy of stack map table
- * is already contained, the old one is removed.
- *
- * @param smt the stack map table added to this code attribute.
- * If it is null, a new stack map is not added.
- * Only the old stack map is removed.
- */
- public void setAttribute(StackMapTable smt) {
- AttributeInfo.remove(attributes, StackMapTable.tag);
- if (smt != null)
- attributes.add(smt);
- }
-
- /**
- * Adds a stack map table for J2ME (CLDC). If another copy of stack map table
- * is already contained, the old one is removed.
- *
- * @param smt the stack map table added to this code attribute.
- * If it is null, a new stack map is not added.
- * Only the old stack map is removed.
- * @since 3.12
- */
- public void setAttribute(StackMap sm) {
- AttributeInfo.remove(attributes, StackMap.tag);
- if (sm != null)
- attributes.add(sm);
- }
-
- /**
- * Copies code.
- */
- private byte[] copyCode(ConstPool destCp, Map classnames,
- ExceptionTable etable, CodeAttribute destCa)
- throws BadBytecode
- {
- int len = getCodeLength();
- byte[] newCode = new byte[len];
- destCa.info = newCode;
- LdcEntry ldc = copyCode(this.info, 0, len, this.getConstPool(),
- newCode, destCp, classnames);
- return LdcEntry.doit(newCode, ldc, etable, destCa);
- }
-
- private static LdcEntry copyCode(byte[] code, int beginPos, int endPos,
- ConstPool srcCp, byte[] newcode,
- ConstPool destCp, Map classnameMap)
- throws BadBytecode
- {
- int i2, index;
- LdcEntry ldcEntry = null;
-
- for (int i = beginPos; i < endPos; i = i2) {
- i2 = CodeIterator.nextOpcode(code, i);
- byte c = code[i];
- newcode[i] = c;
- switch (c & 0xff) {
- case LDC_W :
- case LDC2_W :
- case GETSTATIC :
- case PUTSTATIC :
- case GETFIELD :
- case PUTFIELD :
- case INVOKEVIRTUAL :
- case INVOKESPECIAL :
- case INVOKESTATIC :
- case NEW :
- case ANEWARRAY :
- case CHECKCAST :
- case INSTANCEOF :
- copyConstPoolInfo(i + 1, code, srcCp, newcode, destCp,
- classnameMap);
- break;
- case LDC :
- index = code[i + 1] & 0xff;
- index = srcCp.copy(index, destCp, classnameMap);
- if (index < 0x100)
- newcode[i + 1] = (byte)index;
- else {
- newcode[i] = NOP;
- newcode[i + 1] = NOP;
- LdcEntry ldc = new LdcEntry();
- ldc.where = i;
- ldc.index = index;
- ldc.next = ldcEntry;
- ldcEntry = ldc;
- }
- break;
- case INVOKEINTERFACE :
- copyConstPoolInfo(i + 1, code, srcCp, newcode, destCp,
- classnameMap);
- newcode[i + 3] = code[i + 3];
- newcode[i + 4] = code[i + 4];
- break;
- case MULTIANEWARRAY :
- copyConstPoolInfo(i + 1, code, srcCp, newcode, destCp,
- classnameMap);
- newcode[i + 3] = code[i + 3];
- break;
- default :
- while (++i < i2)
- newcode[i] = code[i];
-
- break;
- }
- }
-
- return ldcEntry;
- }
-
- private static void copyConstPoolInfo(int i, byte[] code, ConstPool srcCp,
- byte[] newcode, ConstPool destCp,
- Map classnameMap) {
- int index = ((code[i] & 0xff) << 8) | (code[i + 1] & 0xff);
- index = srcCp.copy(index, destCp, classnameMap);
- newcode[i] = (byte)(index >> 8);
- newcode[i + 1] = (byte)index;
- }
-
- static class LdcEntry {
- LdcEntry next;
- int where;
- int index;
-
- static byte[] doit(byte[] code, LdcEntry ldc, ExceptionTable etable,
- CodeAttribute ca)
- throws BadBytecode
- {
- if (ldc != null)
- code = CodeIterator.changeLdcToLdcW(code, etable, ca, ldc);
-
- /* The original code was the following:
-
- while (ldc != null) {
- int where = ldc.where;
- code = CodeIterator.insertGapCore0(code, where, 1, false, etable, ca);
- code[where] = (byte)Opcode.LDC_W;
- ByteArray.write16bit(ldc.index, code, where + 1);
- ldc = ldc.next;
- }
-
- But this code does not support a large method > 32KB.
- */
-
- return code;
- }
- }
-
- /**
- * Changes the index numbers of the local variables
- * to append a new parameter.
- * This method does not update <code>LocalVariableAttribute</code>,
- * <code>StackMapTable</code>, or <code>StackMap</code>.
- * These attributes must be explicitly updated.
- *
- * @param where the index of the new parameter.
- * @param size the type size of the new parameter (1 or 2).
- *
- * @see LocalVariableAttribute#shiftIndex(int, int)
- * @see StackMapTable#insertLocal(int, int, int)
- * @see StackMap#insertLocal(int, int, int)
- */
- public void insertLocalVar(int where, int size) throws BadBytecode {
- CodeIterator ci = iterator();
- while (ci.hasNext())
- shiftIndex(ci, where, size);
-
- setMaxLocals(getMaxLocals() + size);
- }
-
- /**
- * @param lessThan If the index of the local variable is
- * less than this value, it does not change.
- * Otherwise, the index is increased.
- * @param delta the indexes of the local variables are
- * increased by this value.
- */
- private static void shiftIndex(CodeIterator ci, int lessThan, int delta) throws BadBytecode {
- int index = ci.next();
- int opcode = ci.byteAt(index);
- if (opcode < ILOAD)
- return;
- else if (opcode < IASTORE) {
- if (opcode < ILOAD_0) {
- // iload, lload, fload, dload, aload
- shiftIndex8(ci, index, opcode, lessThan, delta);
- }
- else if (opcode < IALOAD) {
- // iload_0, ..., aload_3
- shiftIndex0(ci, index, opcode, lessThan, delta, ILOAD_0, ILOAD);
- }
- else if (opcode < ISTORE)
- return;
- else if (opcode < ISTORE_0) {
- // istore, lstore, ...
- shiftIndex8(ci, index, opcode, lessThan, delta);
- }
- else {
- // istore_0, ..., astore_3
- shiftIndex0(ci, index, opcode, lessThan, delta, ISTORE_0, ISTORE);
- }
- }
- else if (opcode == IINC) {
- int var = ci.byteAt(index + 1);
- if (var < lessThan)
- return;
-
- var += delta;
- if (var < 0x100)
- ci.writeByte(var, index + 1);
- else {
- int plus = (byte)ci.byteAt(index + 2);
- int pos = ci.insertExGap(3);
- ci.writeByte(WIDE, pos - 3);
- ci.writeByte(IINC, pos - 2);
- ci.write16bit(var, pos - 1);
- ci.write16bit(plus, pos + 1);
- }
- }
- else if (opcode == RET)
- shiftIndex8(ci, index, opcode, lessThan, delta);
- else if (opcode == WIDE) {
- int var = ci.u16bitAt(index + 2);
- if (var < lessThan)
- return;
-
- var += delta;
- ci.write16bit(var, index + 2);
- }
- }
-
- private static void shiftIndex8(CodeIterator ci, int index, int opcode,
- int lessThan, int delta)
- throws BadBytecode
- {
- int var = ci.byteAt(index + 1);
- if (var < lessThan)
- return;
-
- var += delta;
- if (var < 0x100)
- ci.writeByte(var, index + 1);
- else {
- int pos = ci.insertExGap(2);
- ci.writeByte(WIDE, pos - 2);
- ci.writeByte(opcode, pos - 1);
- ci.write16bit(var, pos);
- }
- }
-
- private static void shiftIndex0(CodeIterator ci, int index, int opcode,
- int lessThan, int delta,
- int opcode_i_0, int opcode_i)
- throws BadBytecode
- {
- int var = (opcode - opcode_i_0) % 4;
- if (var < lessThan)
- return;
-
- var += delta;
- if (var < 4)
- ci.writeByte(opcode + delta, index);
- else {
- opcode = (opcode - opcode_i_0) / 4 + opcode_i;
- if (var < 0x100) {
- int pos = ci.insertExGap(1);
- ci.writeByte(opcode, pos - 1);
- ci.writeByte(var, pos);
- }
- else {
- int pos = ci.insertExGap(3);
- ci.writeByte(WIDE, pos - 1);
- ci.writeByte(opcode, pos);
- ci.write16bit(var, pos + 1);
- }
- }
- }
-}
Copied: tags/rel_3_12_0_ga/src/main/javassist/bytecode/CodeAttribute.java (from rev 532, trunk/src/main/javassist/bytecode/CodeAttribute.java)
===================================================================
--- tags/rel_3_12_0_ga/src/main/javassist/bytecode/CodeAttribute.java (rev 0)
+++ tags/rel_3_12_0_ga/src/main/javassist/bytecode/CodeAttribute.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,581 @@
+/*
+ * Javassist, a Java-bytecode translator toolkit.
+ * Copyright (C) 1999-2007 Shigeru Chiba. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. Alternatively, the contents of this file may be used under
+ * the terms of the GNU Lesser General Public License Version 2.1 or later.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ */
+
+package javassist.bytecode;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * <code>Code_attribute</code>.
+ *
+ * <p>To browse the <code>code</code> field of
+ * a <code>Code_attribute</code> structure,
+ * use <code>CodeIterator</code>.
+ *
+ * @see CodeIterator
+ */
+public class CodeAttribute extends AttributeInfo implements Opcode {
+ /**
+ * The name of this attribute <code>"Code"</code>.
+ */
+ public static final String tag = "Code";
+
+ // code[] is stored in AttributeInfo.info.
+
+ private int maxStack;
+ private int maxLocals;
+ private ExceptionTable exceptions;
+ private LinkedList attributes;
+
+ /**
+ * Constructs a <code>Code_attribute</code>.
+ *
+ * @param cp constant pool table
+ * @param stack <code>max_stack</code>
+ * @param locals <code>max_locals</code>
+ * @param code <code>code[]</code>
+ * @param etable <code>exception_table[]</code>
+ */
+ public CodeAttribute(ConstPool cp, int stack, int locals, byte[] code,
+ ExceptionTable etable)
+ {
+ super(cp, tag);
+ maxStack = stack;
+ maxLocals = locals;
+ info = code;
+ exceptions = etable;
+ attributes = new LinkedList();
+ }
+
+ /**
+ * Constructs a copy of <code>Code_attribute</code>.
+ * Specified class names are replaced during the copy.
+ *
+ * @param cp constant pool table.
+ * @param src source Code attribute.
+ * @param classnames pairs of replaced and substituted
+ * class names.
+ */
+ private CodeAttribute(ConstPool cp, CodeAttribute src, Map classnames)
+ throws BadBytecode
+ {
+ super(cp, tag);
+
+ maxStack = src.getMaxStack();
+ maxLocals = src.getMaxLocals();
+ exceptions = src.getExceptionTable().copy(cp, classnames);
+ attributes = new LinkedList();
+ List src_attr = src.getAttributes();
+ int num = src_attr.size();
+ for (int i = 0; i < num; ++i) {
+ AttributeInfo ai = (AttributeInfo)src_attr.get(i);
+ attributes.add(ai.copy(cp, classnames));
+ }
+
+ info = src.copyCode(cp, classnames, exceptions, this);
+ }
+
+ CodeAttribute(ConstPool cp, int name_id, DataInputStream in)
+ throws IOException
+ {
+ super(cp, name_id, (byte[])null);
+ int attr_len = in.readInt();
+
+ maxStack = in.readUnsignedShort();
+ maxLocals = in.readUnsignedShort();
+
+ int code_len = in.readInt();
+ info = new byte[code_len];
+ in.readFully(info);
+
+ exceptions = new ExceptionTable(cp, in);
+
+ attributes = new LinkedList();
+ int num = in.readUnsignedShort();
+ for (int i = 0; i < num; ++i)
+ attributes.add(AttributeInfo.read(cp, in));
+ }
+
+ /**
+ * Makes a copy. Class names are replaced according to the
+ * given <code>Map</code> object.
+ *
+ * @param newCp the constant pool table used by the new copy.
+ * @param classnames pairs of replaced and substituted
+ * class names.
+ * @exception RuntimeCopyException if a <code>BadBytecode</code>
+ * exception is thrown, it is
+ * converted into
+ * <code>RuntimeCopyException</code>.
+ *
+ * @return <code>CodeAttribute</code> object.
+ */
+ public AttributeInfo copy(ConstPool newCp, Map classnames)
+ throws RuntimeCopyException
+ {
+ try {
+ return new CodeAttribute(newCp, this, classnames);
+ }
+ catch (BadBytecode e) {
+ throw new RuntimeCopyException("bad bytecode. fatal?");
+ }
+ }
+
+ /**
+ * An exception that may be thrown by <code>copy()</code>
+ * in <code>CodeAttribute</code>.
+ */
+ public static class RuntimeCopyException extends RuntimeException {
+ /**
+ * Constructs an exception.
+ */
+ public RuntimeCopyException(String s) {
+ super(s);
+ }
+ }
+
+ /**
+ * Returns the length of this <code>attribute_info</code>
+ * structure.
+ * The returned value is <code>attribute_length + 6</code>.
+ */
+ public int length() {
+ return 18 + info.length + exceptions.size() * 8
+ + AttributeInfo.getLength(attributes);
+ }
+
+ void write(DataOutputStream out) throws IOException {
+ out.writeShort(name); // attribute_name_index
+ out.writeInt(length() - 6); // attribute_length
+ out.writeShort(maxStack); // max_stack
+ out.writeShort(maxLocals); // max_locals
+ out.writeInt(info.length); // code_length
+ out.write(info); // code
+ exceptions.write(out);
+ out.writeShort(attributes.size()); // attributes_count
+ AttributeInfo.writeAll(attributes, out); // attributes
+ }
+
+ /**
+ * This method is not available.
+ *
+ * @throws java.lang.UnsupportedOperationException always thrown.
+ */
+ public byte[] get() {
+ throw new UnsupportedOperationException("CodeAttribute.get()");
+ }
+
+ /**
+ * This method is not available.
+ *
+ * @throws java.lang.UnsupportedOperationException always thrown.
+ */
+ public void set(byte[] newinfo) {
+ throw new UnsupportedOperationException("CodeAttribute.set()");
+ }
+
+ void renameClass(String oldname, String newname) {
+ AttributeInfo.renameClass(attributes, oldname, newname);
+ }
+
+ void renameClass(Map classnames) {
+ AttributeInfo.renameClass(attributes, classnames);
+ }
+
+ /**
+ * Returns the name of the class declaring the method including
+ * this code attribute.
+ */
+ public String getDeclaringClass() {
+ ConstPool cp = getConstPool();
+ return cp.getClassName();
+ }
+
+ /**
+ * Returns <code>max_stack</code>.
+ */
+ public int getMaxStack() {
+ return maxStack;
+ }
+
+ /**
+ * Sets <code>max_stack</code>.
+ */
+ public void setMaxStack(int value) {
+ maxStack = value;
+ }
+
+ /**
+ * Computes the maximum stack size and sets <code>max_stack</code>
+ * to the computed size.
+ *
+ * @throws BadBytecode if this method fails in computing.
+ * @return the newly computed value of <code>max_stack</code>
+ */
+ public int computeMaxStack() throws BadBytecode {
+ maxStack = new CodeAnalyzer(this).computeMaxStack();
+ return maxStack;
+ }
+
+ /**
+ * Returns <code>max_locals</code>.
+ */
+ public int getMaxLocals() {
+ return maxLocals;
+ }
+
+ /**
+ * Sets <code>max_locals</code>.
+ */
+ public void setMaxLocals(int value) {
+ maxLocals = value;
+ }
+
+ /**
+ * Returns <code>code_length</code>.
+ */
+ public int getCodeLength() {
+ return info.length;
+ }
+
+ /**
+ * Returns <code>code[]</code>.
+ */
+ public byte[] getCode() {
+ return info;
+ }
+
+ /**
+ * Sets <code>code[]</code>.
+ */
+ void setCode(byte[] newinfo) { super.set(newinfo); }
+
+ /**
+ * Makes a new iterator for reading this code attribute.
+ */
+ public CodeIterator iterator() {
+ return new CodeIterator(this);
+ }
+
+ /**
+ * Returns <code>exception_table[]</code>.
+ */
+ public ExceptionTable getExceptionTable() { return exceptions; }
+
+ /**
+ * Returns <code>attributes[]</code>.
+ * It returns a list of <code>AttributeInfo</code>.
+ * A new element can be added to the returned list
+ * and an existing element can be removed from the list.
+ *
+ * @see AttributeInfo
+ */
+ public List getAttributes() { return attributes; }
+
+ /**
+ * Returns the attribute with the specified name.
+ * If it is not found, this method returns null.
+ *
+ * @param name attribute name
+ * @return an <code>AttributeInfo</code> object or null.
+ */
+ public AttributeInfo getAttribute(String name) {
+ return AttributeInfo.lookup(attributes, name);
+ }
+
+ /**
+ * Adds a stack map table. If another copy of stack map table
+ * is already contained, the old one is removed.
+ *
+ * @param smt the stack map table added to this code attribute.
+ * If it is null, a new stack map is not added.
+ * Only the old stack map is removed.
+ */
+ public void setAttribute(StackMapTable smt) {
+ AttributeInfo.remove(attributes, StackMapTable.tag);
+ if (smt != null)
+ attributes.add(smt);
+ }
+
+ /**
+ * Adds a stack map table for J2ME (CLDC). If another copy of stack map table
+ * is already contained, the old one is removed.
+ *
+ * @param sm the stack map table added to this code attribute.
+ * If it is null, a new stack map is not added.
+ * Only the old stack map is removed.
+ * @since 3.12
+ */
+ public void setAttribute(StackMap sm) {
+ AttributeInfo.remove(attributes, StackMap.tag);
+ if (sm != null)
+ attributes.add(sm);
+ }
+
+ /**
+ * Copies code.
+ */
+ private byte[] copyCode(ConstPool destCp, Map classnames,
+ ExceptionTable etable, CodeAttribute destCa)
+ throws BadBytecode
+ {
+ int len = getCodeLength();
+ byte[] newCode = new byte[len];
+ destCa.info = newCode;
+ LdcEntry ldc = copyCode(this.info, 0, len, this.getConstPool(),
+ newCode, destCp, classnames);
+ return LdcEntry.doit(newCode, ldc, etable, destCa);
+ }
+
+ private static LdcEntry copyCode(byte[] code, int beginPos, int endPos,
+ ConstPool srcCp, byte[] newcode,
+ ConstPool destCp, Map classnameMap)
+ throws BadBytecode
+ {
+ int i2, index;
+ LdcEntry ldcEntry = null;
+
+ for (int i = beginPos; i < endPos; i = i2) {
+ i2 = CodeIterator.nextOpcode(code, i);
+ byte c = code[i];
+ newcode[i] = c;
+ switch (c & 0xff) {
+ case LDC_W :
+ case LDC2_W :
+ case GETSTATIC :
+ case PUTSTATIC :
+ case GETFIELD :
+ case PUTFIELD :
+ case INVOKEVIRTUAL :
+ case INVOKESPECIAL :
+ case INVOKESTATIC :
+ case NEW :
+ case ANEWARRAY :
+ case CHECKCAST :
+ case INSTANCEOF :
+ copyConstPoolInfo(i + 1, code, srcCp, newcode, destCp,
+ classnameMap);
+ break;
+ case LDC :
+ index = code[i + 1] & 0xff;
+ index = srcCp.copy(index, destCp, classnameMap);
+ if (index < 0x100)
+ newcode[i + 1] = (byte)index;
+ else {
+ newcode[i] = NOP;
+ newcode[i + 1] = NOP;
+ LdcEntry ldc = new LdcEntry();
+ ldc.where = i;
+ ldc.index = index;
+ ldc.next = ldcEntry;
+ ldcEntry = ldc;
+ }
+ break;
+ case INVOKEINTERFACE :
+ copyConstPoolInfo(i + 1, code, srcCp, newcode, destCp,
+ classnameMap);
+ newcode[i + 3] = code[i + 3];
+ newcode[i + 4] = code[i + 4];
+ break;
+ case MULTIANEWARRAY :
+ copyConstPoolInfo(i + 1, code, srcCp, newcode, destCp,
+ classnameMap);
+ newcode[i + 3] = code[i + 3];
+ break;
+ default :
+ while (++i < i2)
+ newcode[i] = code[i];
+
+ break;
+ }
+ }
+
+ return ldcEntry;
+ }
+
+ private static void copyConstPoolInfo(int i, byte[] code, ConstPool srcCp,
+ byte[] newcode, ConstPool destCp,
+ Map classnameMap) {
+ int index = ((code[i] & 0xff) << 8) | (code[i + 1] & 0xff);
+ index = srcCp.copy(index, destCp, classnameMap);
+ newcode[i] = (byte)(index >> 8);
+ newcode[i + 1] = (byte)index;
+ }
+
+ static class LdcEntry {
+ LdcEntry next;
+ int where;
+ int index;
+
+ static byte[] doit(byte[] code, LdcEntry ldc, ExceptionTable etable,
+ CodeAttribute ca)
+ throws BadBytecode
+ {
+ if (ldc != null)
+ code = CodeIterator.changeLdcToLdcW(code, etable, ca, ldc);
+
+ /* The original code was the following:
+
+ while (ldc != null) {
+ int where = ldc.where;
+ code = CodeIterator.insertGapCore0(code, where, 1, false, etable, ca);
+ code[where] = (byte)Opcode.LDC_W;
+ ByteArray.write16bit(ldc.index, code, where + 1);
+ ldc = ldc.next;
+ }
+
+ But this code does not support a large method > 32KB.
+ */
+
+ return code;
+ }
+ }
+
+ /**
+ * Changes the index numbers of the local variables
+ * to append a new parameter.
+ * This method does not update <code>LocalVariableAttribute</code>,
+ * <code>StackMapTable</code>, or <code>StackMap</code>.
+ * These attributes must be explicitly updated.
+ *
+ * @param where the index of the new parameter.
+ * @param size the type size of the new parameter (1 or 2).
+ *
+ * @see LocalVariableAttribute#shiftIndex(int, int)
+ * @see StackMapTable#insertLocal(int, int, int)
+ * @see StackMap#insertLocal(int, int, int)
+ */
+ public void insertLocalVar(int where, int size) throws BadBytecode {
+ CodeIterator ci = iterator();
+ while (ci.hasNext())
+ shiftIndex(ci, where, size);
+
+ setMaxLocals(getMaxLocals() + size);
+ }
+
+ /**
+ * @param lessThan If the index of the local variable is
+ * less than this value, it does not change.
+ * Otherwise, the index is increased.
+ * @param delta the indexes of the local variables are
+ * increased by this value.
+ */
+ private static void shiftIndex(CodeIterator ci, int lessThan, int delta) throws BadBytecode {
+ int index = ci.next();
+ int opcode = ci.byteAt(index);
+ if (opcode < ILOAD)
+ return;
+ else if (opcode < IASTORE) {
+ if (opcode < ILOAD_0) {
+ // iload, lload, fload, dload, aload
+ shiftIndex8(ci, index, opcode, lessThan, delta);
+ }
+ else if (opcode < IALOAD) {
+ // iload_0, ..., aload_3
+ shiftIndex0(ci, index, opcode, lessThan, delta, ILOAD_0, ILOAD);
+ }
+ else if (opcode < ISTORE)
+ return;
+ else if (opcode < ISTORE_0) {
+ // istore, lstore, ...
+ shiftIndex8(ci, index, opcode, lessThan, delta);
+ }
+ else {
+ // istore_0, ..., astore_3
+ shiftIndex0(ci, index, opcode, lessThan, delta, ISTORE_0, ISTORE);
+ }
+ }
+ else if (opcode == IINC) {
+ int var = ci.byteAt(index + 1);
+ if (var < lessThan)
+ return;
+
+ var += delta;
+ if (var < 0x100)
+ ci.writeByte(var, index + 1);
+ else {
+ int plus = (byte)ci.byteAt(index + 2);
+ int pos = ci.insertExGap(3);
+ ci.writeByte(WIDE, pos - 3);
+ ci.writeByte(IINC, pos - 2);
+ ci.write16bit(var, pos - 1);
+ ci.write16bit(plus, pos + 1);
+ }
+ }
+ else if (opcode == RET)
+ shiftIndex8(ci, index, opcode, lessThan, delta);
+ else if (opcode == WIDE) {
+ int var = ci.u16bitAt(index + 2);
+ if (var < lessThan)
+ return;
+
+ var += delta;
+ ci.write16bit(var, index + 2);
+ }
+ }
+
+ private static void shiftIndex8(CodeIterator ci, int index, int opcode,
+ int lessThan, int delta)
+ throws BadBytecode
+ {
+ int var = ci.byteAt(index + 1);
+ if (var < lessThan)
+ return;
+
+ var += delta;
+ if (var < 0x100)
+ ci.writeByte(var, index + 1);
+ else {
+ int pos = ci.insertExGap(2);
+ ci.writeByte(WIDE, pos - 2);
+ ci.writeByte(opcode, pos - 1);
+ ci.write16bit(var, pos);
+ }
+ }
+
+ private static void shiftIndex0(CodeIterator ci, int index, int opcode,
+ int lessThan, int delta,
+ int opcode_i_0, int opcode_i)
+ throws BadBytecode
+ {
+ int var = (opcode - opcode_i_0) % 4;
+ if (var < lessThan)
+ return;
+
+ var += delta;
+ if (var < 4)
+ ci.writeByte(opcode + delta, index);
+ else {
+ opcode = (opcode - opcode_i_0) / 4 + opcode_i;
+ if (var < 0x100) {
+ int pos = ci.insertExGap(1);
+ ci.writeByte(opcode, pos - 1);
+ ci.writeByte(var, pos);
+ }
+ else {
+ int pos = ci.insertExGap(3);
+ ci.writeByte(WIDE, pos - 1);
+ ci.writeByte(opcode, pos);
+ ci.write16bit(var, pos + 1);
+ }
+ }
+ }
+}
Deleted: tags/rel_3_12_0_ga/src/main/javassist/bytecode/StackMap.java
===================================================================
--- trunk/src/main/javassist/bytecode/StackMap.java 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/src/main/javassist/bytecode/StackMap.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,545 +0,0 @@
-/*
- * Javassist, a Java-bytecode translator toolkit.
- * Copyright (C) 1999-2007 Shigeru Chiba. All Rights Reserved.
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. Alternatively, the contents of this file may be used under
- * the terms of the GNU Lesser General Public License Version 2.1 or later.
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- */
-
-package javassist.bytecode;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.util.Map;
-
-import javassist.CannotCompileException;
-import javassist.bytecode.StackMapTable.InsertLocal;
-import javassist.bytecode.StackMapTable.NewRemover;
-import javassist.bytecode.StackMapTable.Shifter;
-
-/**
- * Another <code>stack_map</code> attribute defined in CLDC 1.1 for J2ME.
- *
- * <p>This is an entry in the attributes table of a Code attribute.
- * It was introduced by J2ME CLDC 1.1 (JSR 139) for pre-verification.
- *
- * <p>According to the CLDC specification, the sizes of some fields are not 16bit
- * but 32bit if the code size is more than 64K or the number of the local variables
- * is more than 64K. However, for the J2ME CLDC technology, they are always 16bit.
- * The implementation of the StackMap class assumes they are 16bit.
- *
- * @see MethodInfo#doPreverify
- * @see StackMapTable
- * @since 3.12
- */
-public class StackMap extends AttributeInfo {
- /**
- * The name of this attribute <code>"StackMap"</code>.
- */
- public static final String tag = "StackMap";
-
-
- /**
- * Constructs a <code>stack_map</code> attribute.
- */
- StackMap(ConstPool cp, byte[] newInfo) {
- super(cp, tag, newInfo);
- }
-
- StackMap(ConstPool cp, int name_id, DataInputStream in)
- throws IOException
- {
- super(cp, name_id, in);
- }
-
- /**
- * Returns <code>number_of_entries</code>.
- */
- public int numOfEntries() {
- return ByteArray.readU16bit(info, 0);
- }
-
- /**
- * <code>Top_variable_info.tag</code>.
- */
- public static final int TOP = 0;
-
- /**
- * <code>Integer_variable_info.tag</code>.
- */
- public static final int INTEGER = 1;
-
- /**
- * <code>Float_variable_info.tag</code>.
- */
- public static final int FLOAT = 2;
-
- /**
- * <code>Double_variable_info.tag</code>.
- */
- public static final int DOUBLE = 3;
-
- /**
- * <code>Long_variable_info.tag</code>.
- */
- public static final int LONG = 4;
-
- /**
- * <code>Null_variable_info.tag</code>.
- */
- public static final int NULL = 5;
-
- /**
- * <code>UninitializedThis_variable_info.tag</code>.
- */
- public static final int THIS = 6;
-
- /**
- * <code>Object_variable_info.tag</code>.
- */
- public static final int OBJECT = 7;
-
- /**
- * <code>Uninitialized_variable_info.tag</code>.
- */
- public static final int UNINIT = 8;
-
- /**
- * Makes a copy.
- */
- public AttributeInfo copy(ConstPool newCp, Map classnames) {
- Copier copier = new Copier(this, newCp, classnames);
- copier.visit();
- return copier.getStackMap();
- }
-
- /**
- * A code walker for a StackMap attribute.
- */
- public static class Walker {
- byte[] info;
-
- /**
- * Constructs a walker.
- */
- public Walker(StackMap sm) {
- info = sm.get();
- }
-
- /**
- * Visits each entry of the stack map frames.
- */
- public void visit() {
- int num = ByteArray.readU16bit(info, 0);
- int pos = 2;
- for (int i = 0; i < num; i++) {
- int offset = ByteArray.readU16bit(info, pos);
- int numLoc = ByteArray.readU16bit(info, pos + 2);
- pos = locals(pos + 4, offset, numLoc);
- int numStack = ByteArray.readU16bit(info, pos);
- pos = stack(pos + 2, offset, numStack);
- }
- }
-
- /**
- * Invoked when <code>locals</code> of <code>stack_map_frame</code>
- * is visited.
- */
- public int locals(int pos, int offset, int num) {
- return typeInfoArray(pos, offset, num, true);
- }
-
- /**
- * Invoked when <code>stack</code> of <code>stack_map_frame</code>
- * is visited.
- */
- public int stack(int pos, int offset, int num) {
- return typeInfoArray(pos, offset, num, false);
- }
-
- /**
- * Invoked when an array of <code>verification_type_info</code> is
- * visited.
- *
- * @param num the number of elements.
- * @param isLocals true if this array is for <code>locals</code>.
- * false if it is for <code>stack</code>.
- * @return
- */
- public int typeInfoArray(int pos, int offset, int num, boolean isLocals) {
- for (int k = 0; k < num; k++)
- pos = typeInfoArray2(k, pos);
-
- return pos;
- }
-
- int typeInfoArray2(int k, int pos) {
- byte tag = info[pos];
- if (tag == OBJECT) {
- int clazz = ByteArray.readU16bit(info, pos + 1);
- objectVariable(pos, clazz);
- pos += 3;
- }
- else if (tag == UNINIT) {
- int offsetOfNew = ByteArray.readU16bit(info, pos + 1);
- uninitialized(pos, offsetOfNew);
- pos += 3;
- }
- else {
- typeInfo(pos, tag);
- pos++;
- }
-
- return pos;
- }
-
- /**
- * Invoked when an element of <code>verification_type_info</code>
- * (except <code>Object_variable_info</code> and
- * <code>Uninitialized_variable_info</code>) is visited.
- */
- public void typeInfo(int pos, byte tag) {}
-
- /**
- * Invoked when an element of type <code>Object_variable_info</code>
- * is visited.
- */
- public void objectVariable(int pos, int clazz) {}
-
- /**
- * Invoked when an element of type <code>Uninitialized_variable_info</code>
- * is visited.
- */
- public void uninitialized(int pos, int offset) {}
- }
-
- static class Copier extends Walker {
- byte[] dest;
- ConstPool srcCp, destCp;
- Map classnames;
-
- Copier(StackMap map, ConstPool newCp, Map classnames) {
- super(map);
- srcCp = map.getConstPool();
- dest = new byte[info.length];
- destCp = newCp;
- this.classnames = classnames;
- }
-
- public void visit() {
- int num = ByteArray.readU16bit(info, 0);
- ByteArray.write16bit(num, dest, 0);
- super.visit();
- }
-
- public int locals(int pos, int offset, int num) {
- ByteArray.write16bit(offset, dest, pos - 4);
- return super.locals(pos, offset, num);
- }
-
- public int typeInfoArray(int pos, int offset, int num, boolean isLocals) {
- ByteArray.write16bit(num, dest, pos - 2);
- return super.typeInfoArray(pos, offset, num, isLocals);
- }
-
- public void typeInfo(int pos, byte tag) {
- dest[pos] = tag;
- }
-
- public void objectVariable(int pos, int clazz) {
- dest[pos] = OBJECT;
- int newClazz = srcCp.copy(clazz, destCp, classnames);
- ByteArray.write16bit(newClazz, dest, pos + 1);
- }
-
- public void uninitialized(int pos, int offset) {
- dest[pos] = UNINIT;
- ByteArray.write16bit(offset, dest, pos + 1);
- }
-
- public StackMap getStackMap() {
- return new StackMap(destCp, dest);
- }
- }
-
- /**
- * Updates this stack map table when a new local variable is inserted
- * for a new parameter.
- *
- * @param index the index of the added local variable.
- * @param tag the type tag of that local variable.
- * It is available by <code>StackMapTable.typeTagOf(char)</code>.
- * @param classInfo the index of the <code>CONSTANT_Class_info</code> structure
- * in a constant pool table. This should be zero unless the tag
- * is <code>ITEM_Object</code>.
- *
- * @see javassist.CtBehavior#addParameter(javassist.CtClass)
- * @see StackMapTable#typeTagOf(char)
- * @see ConstPool
- */
- public void insertLocal(int index, int tag, int classInfo)
- throws BadBytecode
- {
- byte[] data = new InsertLocal(this, index, tag, classInfo).doit();
- this.set(data);
- }
-
- static class SimpleCopy extends Walker {
- Writer writer;
-
- SimpleCopy(StackMap map) {
- super(map);
- writer = new Writer();
- }
-
- byte[] doit() {
- visit();
- return writer.toByteArray();
- }
-
- public void visit() {
- int num = ByteArray.readU16bit(info, 0);
- writer.write16bit(num);
- super.visit();
- }
-
- public int locals(int pos, int offset, int num) {
- writer.write16bit(offset);
- return super.locals(pos, offset, num);
- }
-
- public int typeInfoArray(int pos, int offset, int num, boolean isLocals) {
- writer.write16bit(num);
- return super.typeInfoArray(pos, offset, num, isLocals);
- }
-
- public void typeInfo(int pos, byte tag) {
- writer.writeVerifyTypeInfo(tag, 0);
- }
-
- public void objectVariable(int pos, int clazz) {
- writer.writeVerifyTypeInfo(OBJECT, clazz);
- }
-
- public void uninitialized(int pos, int offset) {
- writer.writeVerifyTypeInfo(UNINIT, offset);
- }
- }
-
- static class InsertLocal extends SimpleCopy {
- private int varIndex;
- private int varTag, varData;
-
- InsertLocal(StackMap map, int varIndex, int varTag, int varData) {
- super(map);
- this.varIndex = varIndex;
- this.varTag = varTag;
- this.varData = varData;
- }
-
- public int typeInfoArray(int pos, int offset, int num, boolean isLocals) {
- if (!isLocals || num < varIndex)
- return super.typeInfoArray(pos, offset, num, isLocals);
-
- writer.write16bit(num + 1);
- for (int k = 0; k < num; k++) {
- if (k == varIndex)
- writeVarTypeInfo();
-
- pos = typeInfoArray2(k, pos);
- }
-
- if (num == varIndex)
- writeVarTypeInfo();
-
- return pos;
- }
-
- private void writeVarTypeInfo() {
- if (varTag == OBJECT)
- writer.writeVerifyTypeInfo(OBJECT, varData);
- else if (varTag == UNINIT)
- writer.writeVerifyTypeInfo(UNINIT, varData);
- else
- writer.writeVerifyTypeInfo(varTag, 0);
- }
- }
-
- void shiftPc(int where, int gapSize, boolean exclusive)
- throws BadBytecode
- {
- new Shifter(this, where, gapSize, exclusive).visit();
- }
-
- static class Shifter extends Walker {
- private int where, gap;
- private boolean exclusive;
-
- public Shifter(StackMap smt, int where, int gap, boolean exclusive) {
- super(smt);
- this.where = where;
- this.gap = gap;
- this.exclusive = exclusive;
- }
-
- public int locals(int pos, int offset, int num) {
- if (exclusive ? where <= offset : where < offset)
- ByteArray.write16bit(offset + gap, info, pos - 4);
-
- return super.locals(pos, offset, num);
- }
- }
-
- /**
- * Undocumented method. Do not use; internal-use only.
- *
- * <p>This method is for javassist.convert.TransformNew.
- * It is called to update the stack map when
- * the NEW opcode (and the following DUP) is removed.
- *
- * @param where the position of the removed NEW opcode.
- */
- public void removeNew(int where) throws CannotCompileException {
- byte[] data = new NewRemover(this, where).doit();
- this.set(data);
- }
-
- static class NewRemover extends SimpleCopy {
- int posOfNew;
-
- NewRemover(StackMap map, int where) {
- super(map);
- posOfNew = where;
- }
-
- public int stack(int pos, int offset, int num) {
- return stackTypeInfoArray(pos, offset, num);
- }
-
- private int stackTypeInfoArray(int pos, int offset, int num) {
- int p = pos;
- int count = 0;
- for (int k = 0; k < num; k++) {
- byte tag = info[p];
- if (tag == OBJECT)
- p += 3;
- else if (tag == UNINIT) {
- int offsetOfNew = ByteArray.readU16bit(info, p + 1);
- if (offsetOfNew == posOfNew)
- count++;
-
- p += 3;
- }
- else
- p++;
- }
-
- writer.write16bit(num - count);
- for (int k = 0; k < num; k++) {
- byte tag = info[pos];
- if (tag == OBJECT) {
- int clazz = ByteArray.readU16bit(info, pos + 1);
- objectVariable(pos, clazz);
- pos += 3;
- }
- else if (tag == UNINIT) {
- int offsetOfNew = ByteArray.readU16bit(info, pos + 1);
- if (offsetOfNew != posOfNew)
- uninitialized(pos, offsetOfNew);
-
- pos += 3;
- }
- else {
- typeInfo(pos, tag);
- pos++;
- }
- }
-
- return pos;
- }
- }
-
- /**
- * Prints this stack map.
- */
- public void print(java.io.PrintWriter out) {
- new Printer(this, out).print();
- }
-
- static class Printer extends Walker {
- private java.io.PrintWriter writer;
-
- public Printer(StackMap map, java.io.PrintWriter out) {
- super(map);
- writer = out;
- }
-
- public void print() {
- int num = ByteArray.readU16bit(info, 0);
- writer.println(num + " entries");
- visit();
- }
-
- public int locals(int pos, int offset, int num) {
- writer.println(" * offset " + offset);
- return super.locals(pos, offset, num);
- }
- }
-
- /**
- * Internal use only.
- */
- public static class Writer {
- // see javassist.bytecode.stackmap.MapMaker
-
- private ByteArrayOutputStream output;
-
- /**
- * Constructs a writer.
- */
- public Writer() {
- output = new ByteArrayOutputStream();
- }
-
- /**
- * Converts the written data into a byte array.
- */
- public byte[] toByteArray() {
- return output.toByteArray();
- }
-
- /**
- * Converts to a <code>StackMap</code> attribute.
- */
- public StackMap toStackMap(ConstPool cp) {
- return new StackMap(cp, output.toByteArray());
- }
-
- /**
- * Writes a <code>union verification_type_info</code> value.
- *
- * @param data <code>cpool_index</code> or <code>offset</code>.
- */
- public void writeVerifyTypeInfo(int tag, int data) {
- output.write(tag);
- if (tag == StackMap.OBJECT || tag == StackMap.UNINIT)
- write16bit(data);
- }
-
- /**
- * Writes a 16bit value.
- */
- public void write16bit(int value) {
- output.write((value >>> 8) & 0xff);
- output.write(value & 0xff);
- }
- }
-}
Copied: tags/rel_3_12_0_ga/src/main/javassist/bytecode/StackMap.java (from rev 532, trunk/src/main/javassist/bytecode/StackMap.java)
===================================================================
--- tags/rel_3_12_0_ga/src/main/javassist/bytecode/StackMap.java (rev 0)
+++ tags/rel_3_12_0_ga/src/main/javassist/bytecode/StackMap.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,544 @@
+/*
+ * Javassist, a Java-bytecode translator toolkit.
+ * Copyright (C) 1999-2007 Shigeru Chiba. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. Alternatively, the contents of this file may be used under
+ * the terms of the GNU Lesser General Public License Version 2.1 or later.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ */
+
+package javassist.bytecode;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.util.Map;
+
+import javassist.CannotCompileException;
+import javassist.bytecode.StackMapTable.InsertLocal;
+import javassist.bytecode.StackMapTable.NewRemover;
+import javassist.bytecode.StackMapTable.Shifter;
+
+/**
+ * Another <code>stack_map</code> attribute defined in CLDC 1.1 for J2ME.
+ *
+ * <p>This is an entry in the attributes table of a Code attribute.
+ * It was introduced by J2ME CLDC 1.1 (JSR 139) for pre-verification.
+ *
+ * <p>According to the CLDC specification, the sizes of some fields are not 16bit
+ * but 32bit if the code size is more than 64K or the number of the local variables
+ * is more than 64K. However, for the J2ME CLDC technology, they are always 16bit.
+ * The implementation of the StackMap class assumes they are 16bit.
+ *
+ * @see MethodInfo#doPreverify
+ * @see StackMapTable
+ * @since 3.12
+ */
+public class StackMap extends AttributeInfo {
+ /**
+ * The name of this attribute <code>"StackMap"</code>.
+ */
+ public static final String tag = "StackMap";
+
+
+ /**
+ * Constructs a <code>stack_map</code> attribute.
+ */
+ StackMap(ConstPool cp, byte[] newInfo) {
+ super(cp, tag, newInfo);
+ }
+
+ StackMap(ConstPool cp, int name_id, DataInputStream in)
+ throws IOException
+ {
+ super(cp, name_id, in);
+ }
+
+ /**
+ * Returns <code>number_of_entries</code>.
+ */
+ public int numOfEntries() {
+ return ByteArray.readU16bit(info, 0);
+ }
+
+ /**
+ * <code>Top_variable_info.tag</code>.
+ */
+ public static final int TOP = 0;
+
+ /**
+ * <code>Integer_variable_info.tag</code>.
+ */
+ public static final int INTEGER = 1;
+
+ /**
+ * <code>Float_variable_info.tag</code>.
+ */
+ public static final int FLOAT = 2;
+
+ /**
+ * <code>Double_variable_info.tag</code>.
+ */
+ public static final int DOUBLE = 3;
+
+ /**
+ * <code>Long_variable_info.tag</code>.
+ */
+ public static final int LONG = 4;
+
+ /**
+ * <code>Null_variable_info.tag</code>.
+ */
+ public static final int NULL = 5;
+
+ /**
+ * <code>UninitializedThis_variable_info.tag</code>.
+ */
+ public static final int THIS = 6;
+
+ /**
+ * <code>Object_variable_info.tag</code>.
+ */
+ public static final int OBJECT = 7;
+
+ /**
+ * <code>Uninitialized_variable_info.tag</code>.
+ */
+ public static final int UNINIT = 8;
+
+ /**
+ * Makes a copy.
+ */
+ public AttributeInfo copy(ConstPool newCp, Map classnames) {
+ Copier copier = new Copier(this, newCp, classnames);
+ copier.visit();
+ return copier.getStackMap();
+ }
+
+ /**
+ * A code walker for a StackMap attribute.
+ */
+ public static class Walker {
+ byte[] info;
+
+ /**
+ * Constructs a walker.
+ */
+ public Walker(StackMap sm) {
+ info = sm.get();
+ }
+
+ /**
+ * Visits each entry of the stack map frames.
+ */
+ public void visit() {
+ int num = ByteArray.readU16bit(info, 0);
+ int pos = 2;
+ for (int i = 0; i < num; i++) {
+ int offset = ByteArray.readU16bit(info, pos);
+ int numLoc = ByteArray.readU16bit(info, pos + 2);
+ pos = locals(pos + 4, offset, numLoc);
+ int numStack = ByteArray.readU16bit(info, pos);
+ pos = stack(pos + 2, offset, numStack);
+ }
+ }
+
+ /**
+ * Invoked when <code>locals</code> of <code>stack_map_frame</code>
+ * is visited.
+ */
+ public int locals(int pos, int offset, int num) {
+ return typeInfoArray(pos, offset, num, true);
+ }
+
+ /**
+ * Invoked when <code>stack</code> of <code>stack_map_frame</code>
+ * is visited.
+ */
+ public int stack(int pos, int offset, int num) {
+ return typeInfoArray(pos, offset, num, false);
+ }
+
+ /**
+ * Invoked when an array of <code>verification_type_info</code> is
+ * visited.
+ *
+ * @param num the number of elements.
+ * @param isLocals true if this array is for <code>locals</code>.
+ * false if it is for <code>stack</code>.
+ */
+ public int typeInfoArray(int pos, int offset, int num, boolean isLocals) {
+ for (int k = 0; k < num; k++)
+ pos = typeInfoArray2(k, pos);
+
+ return pos;
+ }
+
+ int typeInfoArray2(int k, int pos) {
+ byte tag = info[pos];
+ if (tag == OBJECT) {
+ int clazz = ByteArray.readU16bit(info, pos + 1);
+ objectVariable(pos, clazz);
+ pos += 3;
+ }
+ else if (tag == UNINIT) {
+ int offsetOfNew = ByteArray.readU16bit(info, pos + 1);
+ uninitialized(pos, offsetOfNew);
+ pos += 3;
+ }
+ else {
+ typeInfo(pos, tag);
+ pos++;
+ }
+
+ return pos;
+ }
+
+ /**
+ * Invoked when an element of <code>verification_type_info</code>
+ * (except <code>Object_variable_info</code> and
+ * <code>Uninitialized_variable_info</code>) is visited.
+ */
+ public void typeInfo(int pos, byte tag) {}
+
+ /**
+ * Invoked when an element of type <code>Object_variable_info</code>
+ * is visited.
+ */
+ public void objectVariable(int pos, int clazz) {}
+
+ /**
+ * Invoked when an element of type <code>Uninitialized_variable_info</code>
+ * is visited.
+ */
+ public void uninitialized(int pos, int offset) {}
+ }
+
+ static class Copier extends Walker {
+ byte[] dest;
+ ConstPool srcCp, destCp;
+ Map classnames;
+
+ Copier(StackMap map, ConstPool newCp, Map classnames) {
+ super(map);
+ srcCp = map.getConstPool();
+ dest = new byte[info.length];
+ destCp = newCp;
+ this.classnames = classnames;
+ }
+
+ public void visit() {
+ int num = ByteArray.readU16bit(info, 0);
+ ByteArray.write16bit(num, dest, 0);
+ super.visit();
+ }
+
+ public int locals(int pos, int offset, int num) {
+ ByteArray.write16bit(offset, dest, pos - 4);
+ return super.locals(pos, offset, num);
+ }
+
+ public int typeInfoArray(int pos, int offset, int num, boolean isLocals) {
+ ByteArray.write16bit(num, dest, pos - 2);
+ return super.typeInfoArray(pos, offset, num, isLocals);
+ }
+
+ public void typeInfo(int pos, byte tag) {
+ dest[pos] = tag;
+ }
+
+ public void objectVariable(int pos, int clazz) {
+ dest[pos] = OBJECT;
+ int newClazz = srcCp.copy(clazz, destCp, classnames);
+ ByteArray.write16bit(newClazz, dest, pos + 1);
+ }
+
+ public void uninitialized(int pos, int offset) {
+ dest[pos] = UNINIT;
+ ByteArray.write16bit(offset, dest, pos + 1);
+ }
+
+ public StackMap getStackMap() {
+ return new StackMap(destCp, dest);
+ }
+ }
+
+ /**
+ * Updates this stack map table when a new local variable is inserted
+ * for a new parameter.
+ *
+ * @param index the index of the added local variable.
+ * @param tag the type tag of that local variable.
+ * It is available by <code>StackMapTable.typeTagOf(char)</code>.
+ * @param classInfo the index of the <code>CONSTANT_Class_info</code> structure
+ * in a constant pool table. This should be zero unless the tag
+ * is <code>ITEM_Object</code>.
+ *
+ * @see javassist.CtBehavior#addParameter(javassist.CtClass)
+ * @see StackMapTable#typeTagOf(char)
+ * @see ConstPool
+ */
+ public void insertLocal(int index, int tag, int classInfo)
+ throws BadBytecode
+ {
+ byte[] data = new InsertLocal(this, index, tag, classInfo).doit();
+ this.set(data);
+ }
+
+ static class SimpleCopy extends Walker {
+ Writer writer;
+
+ SimpleCopy(StackMap map) {
+ super(map);
+ writer = new Writer();
+ }
+
+ byte[] doit() {
+ visit();
+ return writer.toByteArray();
+ }
+
+ public void visit() {
+ int num = ByteArray.readU16bit(info, 0);
+ writer.write16bit(num);
+ super.visit();
+ }
+
+ public int locals(int pos, int offset, int num) {
+ writer.write16bit(offset);
+ return super.locals(pos, offset, num);
+ }
+
+ public int typeInfoArray(int pos, int offset, int num, boolean isLocals) {
+ writer.write16bit(num);
+ return super.typeInfoArray(pos, offset, num, isLocals);
+ }
+
+ public void typeInfo(int pos, byte tag) {
+ writer.writeVerifyTypeInfo(tag, 0);
+ }
+
+ public void objectVariable(int pos, int clazz) {
+ writer.writeVerifyTypeInfo(OBJECT, clazz);
+ }
+
+ public void uninitialized(int pos, int offset) {
+ writer.writeVerifyTypeInfo(UNINIT, offset);
+ }
+ }
+
+ static class InsertLocal extends SimpleCopy {
+ private int varIndex;
+ private int varTag, varData;
+
+ InsertLocal(StackMap map, int varIndex, int varTag, int varData) {
+ super(map);
+ this.varIndex = varIndex;
+ this.varTag = varTag;
+ this.varData = varData;
+ }
+
+ public int typeInfoArray(int pos, int offset, int num, boolean isLocals) {
+ if (!isLocals || num < varIndex)
+ return super.typeInfoArray(pos, offset, num, isLocals);
+
+ writer.write16bit(num + 1);
+ for (int k = 0; k < num; k++) {
+ if (k == varIndex)
+ writeVarTypeInfo();
+
+ pos = typeInfoArray2(k, pos);
+ }
+
+ if (num == varIndex)
+ writeVarTypeInfo();
+
+ return pos;
+ }
+
+ private void writeVarTypeInfo() {
+ if (varTag == OBJECT)
+ writer.writeVerifyTypeInfo(OBJECT, varData);
+ else if (varTag == UNINIT)
+ writer.writeVerifyTypeInfo(UNINIT, varData);
+ else
+ writer.writeVerifyTypeInfo(varTag, 0);
+ }
+ }
+
+ void shiftPc(int where, int gapSize, boolean exclusive)
+ throws BadBytecode
+ {
+ new Shifter(this, where, gapSize, exclusive).visit();
+ }
+
+ static class Shifter extends Walker {
+ private int where, gap;
+ private boolean exclusive;
+
+ public Shifter(StackMap smt, int where, int gap, boolean exclusive) {
+ super(smt);
+ this.where = where;
+ this.gap = gap;
+ this.exclusive = exclusive;
+ }
+
+ public int locals(int pos, int offset, int num) {
+ if (exclusive ? where <= offset : where < offset)
+ ByteArray.write16bit(offset + gap, info, pos - 4);
+
+ return super.locals(pos, offset, num);
+ }
+ }
+
+ /**
+ * Undocumented method. Do not use; internal-use only.
+ *
+ * <p>This method is for javassist.convert.TransformNew.
+ * It is called to update the stack map when
+ * the NEW opcode (and the following DUP) is removed.
+ *
+ * @param where the position of the removed NEW opcode.
+ */
+ public void removeNew(int where) throws CannotCompileException {
+ byte[] data = new NewRemover(this, where).doit();
+ this.set(data);
+ }
+
+ static class NewRemover extends SimpleCopy {
+ int posOfNew;
+
+ NewRemover(StackMap map, int where) {
+ super(map);
+ posOfNew = where;
+ }
+
+ public int stack(int pos, int offset, int num) {
+ return stackTypeInfoArray(pos, offset, num);
+ }
+
+ private int stackTypeInfoArray(int pos, int offset, int num) {
+ int p = pos;
+ int count = 0;
+ for (int k = 0; k < num; k++) {
+ byte tag = info[p];
+ if (tag == OBJECT)
+ p += 3;
+ else if (tag == UNINIT) {
+ int offsetOfNew = ByteArray.readU16bit(info, p + 1);
+ if (offsetOfNew == posOfNew)
+ count++;
+
+ p += 3;
+ }
+ else
+ p++;
+ }
+
+ writer.write16bit(num - count);
+ for (int k = 0; k < num; k++) {
+ byte tag = info[pos];
+ if (tag == OBJECT) {
+ int clazz = ByteArray.readU16bit(info, pos + 1);
+ objectVariable(pos, clazz);
+ pos += 3;
+ }
+ else if (tag == UNINIT) {
+ int offsetOfNew = ByteArray.readU16bit(info, pos + 1);
+ if (offsetOfNew != posOfNew)
+ uninitialized(pos, offsetOfNew);
+
+ pos += 3;
+ }
+ else {
+ typeInfo(pos, tag);
+ pos++;
+ }
+ }
+
+ return pos;
+ }
+ }
+
+ /**
+ * Prints this stack map.
+ */
+ public void print(java.io.PrintWriter out) {
+ new Printer(this, out).print();
+ }
+
+ static class Printer extends Walker {
+ private java.io.PrintWriter writer;
+
+ public Printer(StackMap map, java.io.PrintWriter out) {
+ super(map);
+ writer = out;
+ }
+
+ public void print() {
+ int num = ByteArray.readU16bit(info, 0);
+ writer.println(num + " entries");
+ visit();
+ }
+
+ public int locals(int pos, int offset, int num) {
+ writer.println(" * offset " + offset);
+ return super.locals(pos, offset, num);
+ }
+ }
+
+ /**
+ * Internal use only.
+ */
+ public static class Writer {
+ // see javassist.bytecode.stackmap.MapMaker
+
+ private ByteArrayOutputStream output;
+
+ /**
+ * Constructs a writer.
+ */
+ public Writer() {
+ output = new ByteArrayOutputStream();
+ }
+
+ /**
+ * Converts the written data into a byte array.
+ */
+ public byte[] toByteArray() {
+ return output.toByteArray();
+ }
+
+ /**
+ * Converts to a <code>StackMap</code> attribute.
+ */
+ public StackMap toStackMap(ConstPool cp) {
+ return new StackMap(cp, output.toByteArray());
+ }
+
+ /**
+ * Writes a <code>union verification_type_info</code> value.
+ *
+ * @param data <code>cpool_index</code> or <code>offset</code>.
+ */
+ public void writeVerifyTypeInfo(int tag, int data) {
+ output.write(tag);
+ if (tag == StackMap.OBJECT || tag == StackMap.UNINIT)
+ write16bit(data);
+ }
+
+ /**
+ * Writes a 16bit value.
+ */
+ public void write16bit(int value) {
+ output.write((value >>> 8) & 0xff);
+ output.write(value & 0xff);
+ }
+ }
+}
Deleted: tags/rel_3_12_0_ga/src/main/javassist/bytecode/annotation/Annotation.java
===================================================================
--- trunk/src/main/javassist/bytecode/annotation/Annotation.java 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/src/main/javassist/bytecode/annotation/Annotation.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,347 +0,0 @@
-/*
- * Javassist, a Java-bytecode translator toolkit.
- * Copyright (C) 2004 Bill Burke. All Rights Reserved.
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. Alternatively, the contents of this file may be used under
- * the terms of the GNU Lesser General Public License Version 2.1 or later.
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- */
-
-package javassist.bytecode.annotation;
-
-import javassist.bytecode.ConstPool;
-import javassist.bytecode.Descriptor;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.CtMethod;
-import javassist.NotFoundException;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.Iterator;
-
-/**
- * The <code>annotation</code> structure.
- *
- * <p>An instance of this class is returned by
- * <code>getAnnotations()</code> in <code>AnnotationsAttribute</code>
- * or in <code>ParameterAnnotationsAttribute</code>.
- *
- * @see javassist.bytecode.AnnotationsAttribute#getAnnotations()
- * @see javassist.bytecode.ParameterAnnotationsAttribute#getAnnotations()
- * @see MemberValue
- * @see MemberValueVisitor
- * @see AnnotationsWriter
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author Shigeru Chiba
- * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
- */
-public class Annotation {
- static class Pair {
- int name;
- MemberValue value;
- }
-
- ConstPool pool;
- int typeIndex;
- HashMap members; // this sould be LinkedHashMap
- // but it is not supported by JDK 1.3.
-
- /**
- * Constructs an annotation including no members. A member can be
- * later added to the created annotation by <code>addMemberValue()</code>.
- *
- * @param type the index into the constant pool table.
- * the entry at that index must be the
- * <code>CONSTANT_Utf8_Info</code> structure
- * repreenting the name of the annotation interface type.
- * @param cp the constant pool table.
- *
- * @see #addMemberValue(String, MemberValue)
- */
- public Annotation(int type, ConstPool cp) {
- pool = cp;
- typeIndex = type;
- members = null;
- }
-
- /**
- * Constructs an annotation including no members. A member can be
- * later added to the created annotation by <code>addMemberValue()</code>.
- *
- * @param typeName the name of the annotation interface type.
- * @param cp the constant pool table.
- *
- * @see #addMemberValue(String, MemberValue)
- */
- public Annotation(String typeName, ConstPool cp) {
- this(cp.addUtf8Info(Descriptor.of(typeName)), cp);
- }
-
- /**
- * Constructs an annotation that can be accessed through the interface
- * represented by <code>clazz</code>. The values of the members are
- * not specified.
- *
- * @param cp the constant pool table.
- * @param clazz the interface.
- * @throws NotFoundException when the clazz is not found
- */
- public Annotation(ConstPool cp, CtClass clazz)
- throws NotFoundException
- {
- // todo Enums are not supported right now.
- this(cp.addUtf8Info(Descriptor.of(clazz.getName())), cp);
-
- if (!clazz.isInterface())
- throw new RuntimeException(
- "Only interfaces are allowed for Annotation creation.");
-
- CtMethod methods[] = clazz.getDeclaredMethods();
- if (methods.length > 0) {
- members = new HashMap();
- }
-
- for (int i = 0; i < methods.length; i++) {
- CtClass returnType = methods[i].getReturnType();
- addMemberValue(methods[i].getName(),
- createMemberValue(cp, returnType));
-
- }
- }
-
- /**
- * Makes an instance of <code>MemberValue</code>.
- *
- * @param cp the constant pool table.
- * @param type the type of the member.
- * @return the member value
- * @throws NotFoundException when the type is not found
- */
- public static MemberValue createMemberValue(ConstPool cp, CtClass type)
- throws NotFoundException
- {
- if (type == CtClass.booleanType)
- return new BooleanMemberValue(cp);
- else if (type == CtClass.byteType)
- return new ByteMemberValue(cp);
- else if (type == CtClass.charType)
- return new CharMemberValue(cp);
- else if (type == CtClass.shortType)
- return new ShortMemberValue(cp);
- else if (type == CtClass.intType)
- return new IntegerMemberValue(cp);
- else if (type == CtClass.longType)
- return new LongMemberValue(cp);
- else if (type == CtClass.floatType)
- return new FloatMemberValue(cp);
- else if (type == CtClass.doubleType)
- return new DoubleMemberValue(cp);
- else if (type.getName().equals("java.lang.Class"))
- return new ClassMemberValue(cp);
- else if (type.getName().equals("java.lang.String"))
- return new StringMemberValue(cp);
- else if (type.isArray()) {
- CtClass arrayType = type.getComponentType();
- MemberValue member = createMemberValue(cp, arrayType);
- return new ArrayMemberValue(member, cp);
- }
- else if (type.isInterface()) {
- Annotation info = new Annotation(cp, type);
- return new AnnotationMemberValue(info, cp);
- }
- else {
- // treat as enum. I know this is not typed,
- // but JBoss has an Annotation Compiler for JDK 1.4
- // and I want it to work with that. - Bill Burke
- EnumMemberValue emv = new EnumMemberValue(cp);
- emv.setType(type.getName());
- return emv;
- }
- }
-
- /**
- * Adds a new member.
- *
- * @param nameIndex the index into the constant pool table.
- * The entry at that index must be
- * a <code>CONSTANT_Utf8_info</code> structure.
- * structure representing the member name.
- * @param value the member value.
- */
- public void addMemberValue(int nameIndex, MemberValue value) {
- Pair p = new Pair();
- p.name = nameIndex;
- p.value = value;
- addMemberValue(p);
- }
-
- /**
- * Adds a new member.
- *
- * @param name the member name.
- * @param value the member value.
- */
- public void addMemberValue(String name, MemberValue value) {
- Pair p = new Pair();
- p.name = pool.addUtf8Info(name);
- p.value = value;
- if (members == null)
- members = new HashMap();
-
- members.put(name, p);
- }
-
- private void addMemberValue(Pair pair) {
- String name = pool.getUtf8Info(pair.name);
- if (members == null)
- members = new HashMap();
-
- members.put(name, pair);
- }
-
- /**
- * Returns a string representation of the annotation.
- */
- public String toString() {
- StringBuffer buf = new StringBuffer("@");
- buf.append(getTypeName());
- if (members != null) {
- buf.append("(");
- Iterator mit = members.keySet().iterator();
- while (mit.hasNext()) {
- String name = (String)mit.next();
- buf.append(name).append("=").append(getMemberValue(name));
- if (mit.hasNext())
- buf.append(", ");
- }
- buf.append(")");
- }
-
- return buf.toString();
- }
-
- /**
- * Obtains the name of the annotation type.
- *
- * @return the type name
- */
- public String getTypeName() {
- return Descriptor.toClassName(pool.getUtf8Info(typeIndex));
- }
-
- /**
- * Obtains all the member names.
- *
- * @return null if no members are defined.
- */
- public Set getMemberNames() {
- if (members == null)
- return null;
- else
- return members.keySet();
- }
-
- /**
- * Obtains the member value with the given name.
- *
- * <p>If this annotation does not have a value for the
- * specified member,
- * this method returns null. It does not return a
- * <code>MemberValue</code> with the default value.
- * The default value can be obtained from the annotation type.
- *
- * @param name the member name
- * @return null if the member cannot be found or if the value is
- * the default value.
- *
- * @see javassist.bytecode.AnnotationDefaultAttribute
- */
- public MemberValue getMemberValue(String name) {
- if (members == null)
- return null;
- else {
- Pair p = (Pair)members.get(name);
- if (p == null)
- return null;
- else
- return p.value;
- }
- }
-
- /**
- * Constructs an annotation-type object representing this annotation.
- * For example, if this annotation represents <code>@Author</code>,
- * this method returns an <code>Author</code> object.
- *
- * @param cl class loader for loading an annotation type.
- * @param cp class pool for obtaining class files.
- * @return the annotation
- * @throws ClassNotFoundException if the class cannot found.
- * @throws NoSuchClassError if the class linkage fails.
- */
- public Object toAnnotationType(ClassLoader cl, ClassPool cp)
- throws ClassNotFoundException, NoSuchClassError
- {
- return AnnotationImpl.make(cl,
- MemberValue.loadClass(cl, getTypeName()),
- cp, this);
- }
-
- /**
- * Writes this annotation.
- *
- * @param writer the output.
- * @throws IOException for an error during the write
- */
- public void write(AnnotationsWriter writer) throws IOException {
- String typeName = pool.getUtf8Info(typeIndex);
- if (members == null) {
- writer.annotation(typeName, 0);
- return;
- }
-
- writer.annotation(typeName, members.size());
- Iterator it = members.values().iterator();
- while (it.hasNext()) {
- Pair pair = (Pair)it.next();
- writer.memberValuePair(pair.name);
- pair.value.write(writer);
- }
- }
-
- /**
- * Returns true if the given object represents the same annotation
- * as this object. The equality test checks the member values.
- */
- public boolean equals(Object obj) {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof Annotation == false)
- return false;
-
- Annotation other = (Annotation) obj;
-
- if (getTypeName().equals(other.getTypeName()) == false)
- return false;
-
- HashMap otherMembers = other.members;
- if (members == otherMembers)
- return true;
- else if (members == null)
- return otherMembers == null;
- else
- if (otherMembers == null)
- return false;
- else
- return members.equals(otherMembers);
- }
-}
Copied: tags/rel_3_12_0_ga/src/main/javassist/bytecode/annotation/Annotation.java (from rev 530, trunk/src/main/javassist/bytecode/annotation/Annotation.java)
===================================================================
--- tags/rel_3_12_0_ga/src/main/javassist/bytecode/annotation/Annotation.java (rev 0)
+++ tags/rel_3_12_0_ga/src/main/javassist/bytecode/annotation/Annotation.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,347 @@
+/*
+ * Javassist, a Java-bytecode translator toolkit.
+ * Copyright (C) 2004 Bill Burke. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. Alternatively, the contents of this file may be used under
+ * the terms of the GNU Lesser General Public License Version 2.1 or later.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ */
+
+package javassist.bytecode.annotation;
+
+import javassist.bytecode.ConstPool;
+import javassist.bytecode.Descriptor;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtMethod;
+import javassist.NotFoundException;
+
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import java.util.Iterator;
+
+/**
+ * The <code>annotation</code> structure.
+ *
+ * <p>An instance of this class is returned by
+ * <code>getAnnotations()</code> in <code>AnnotationsAttribute</code>
+ * or in <code>ParameterAnnotationsAttribute</code>.
+ *
+ * @see javassist.bytecode.AnnotationsAttribute#getAnnotations()
+ * @see javassist.bytecode.ParameterAnnotationsAttribute#getAnnotations()
+ * @see MemberValue
+ * @see MemberValueVisitor
+ * @see AnnotationsWriter
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Shigeru Chiba
+ * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ */
+public class Annotation {
+ static class Pair {
+ int name;
+ MemberValue value;
+ }
+
+ ConstPool pool;
+ int typeIndex;
+ LinkedHashMap members; // this sould be LinkedHashMap
+ // but it is not supported by JDK 1.3.
+
+ /**
+ * Constructs an annotation including no members. A member can be
+ * later added to the created annotation by <code>addMemberValue()</code>.
+ *
+ * @param type the index into the constant pool table.
+ * the entry at that index must be the
+ * <code>CONSTANT_Utf8_Info</code> structure
+ * repreenting the name of the annotation interface type.
+ * @param cp the constant pool table.
+ *
+ * @see #addMemberValue(String, MemberValue)
+ */
+ public Annotation(int type, ConstPool cp) {
+ pool = cp;
+ typeIndex = type;
+ members = null;
+ }
+
+ /**
+ * Constructs an annotation including no members. A member can be
+ * later added to the created annotation by <code>addMemberValue()</code>.
+ *
+ * @param typeName the name of the annotation interface type.
+ * @param cp the constant pool table.
+ *
+ * @see #addMemberValue(String, MemberValue)
+ */
+ public Annotation(String typeName, ConstPool cp) {
+ this(cp.addUtf8Info(Descriptor.of(typeName)), cp);
+ }
+
+ /**
+ * Constructs an annotation that can be accessed through the interface
+ * represented by <code>clazz</code>. The values of the members are
+ * not specified.
+ *
+ * @param cp the constant pool table.
+ * @param clazz the interface.
+ * @throws NotFoundException when the clazz is not found
+ */
+ public Annotation(ConstPool cp, CtClass clazz)
+ throws NotFoundException
+ {
+ // todo Enums are not supported right now.
+ this(cp.addUtf8Info(Descriptor.of(clazz.getName())), cp);
+
+ if (!clazz.isInterface())
+ throw new RuntimeException(
+ "Only interfaces are allowed for Annotation creation.");
+
+ CtMethod methods[] = clazz.getDeclaredMethods();
+ if (methods.length > 0) {
+ members = new LinkedHashMap();
+ }
+
+ for (int i = 0; i < methods.length; i++) {
+ CtClass returnType = methods[i].getReturnType();
+ addMemberValue(methods[i].getName(),
+ createMemberValue(cp, returnType));
+
+ }
+ }
+
+ /**
+ * Makes an instance of <code>MemberValue</code>.
+ *
+ * @param cp the constant pool table.
+ * @param type the type of the member.
+ * @return the member value
+ * @throws NotFoundException when the type is not found
+ */
+ public static MemberValue createMemberValue(ConstPool cp, CtClass type)
+ throws NotFoundException
+ {
+ if (type == CtClass.booleanType)
+ return new BooleanMemberValue(cp);
+ else if (type == CtClass.byteType)
+ return new ByteMemberValue(cp);
+ else if (type == CtClass.charType)
+ return new CharMemberValue(cp);
+ else if (type == CtClass.shortType)
+ return new ShortMemberValue(cp);
+ else if (type == CtClass.intType)
+ return new IntegerMemberValue(cp);
+ else if (type == CtClass.longType)
+ return new LongMemberValue(cp);
+ else if (type == CtClass.floatType)
+ return new FloatMemberValue(cp);
+ else if (type == CtClass.doubleType)
+ return new DoubleMemberValue(cp);
+ else if (type.getName().equals("java.lang.Class"))
+ return new ClassMemberValue(cp);
+ else if (type.getName().equals("java.lang.String"))
+ return new StringMemberValue(cp);
+ else if (type.isArray()) {
+ CtClass arrayType = type.getComponentType();
+ MemberValue member = createMemberValue(cp, arrayType);
+ return new ArrayMemberValue(member, cp);
+ }
+ else if (type.isInterface()) {
+ Annotation info = new Annotation(cp, type);
+ return new AnnotationMemberValue(info, cp);
+ }
+ else {
+ // treat as enum. I know this is not typed,
+ // but JBoss has an Annotation Compiler for JDK 1.4
+ // and I want it to work with that. - Bill Burke
+ EnumMemberValue emv = new EnumMemberValue(cp);
+ emv.setType(type.getName());
+ return emv;
+ }
+ }
+
+ /**
+ * Adds a new member.
+ *
+ * @param nameIndex the index into the constant pool table.
+ * The entry at that index must be
+ * a <code>CONSTANT_Utf8_info</code> structure.
+ * structure representing the member name.
+ * @param value the member value.
+ */
+ public void addMemberValue(int nameIndex, MemberValue value) {
+ Pair p = new Pair();
+ p.name = nameIndex;
+ p.value = value;
+ addMemberValue(p);
+ }
+
+ /**
+ * Adds a new member.
+ *
+ * @param name the member name.
+ * @param value the member value.
+ */
+ public void addMemberValue(String name, MemberValue value) {
+ Pair p = new Pair();
+ p.name = pool.addUtf8Info(name);
+ p.value = value;
+ if (members == null)
+ members = new LinkedHashMap();
+
+ members.put(name, p);
+ }
+
+ private void addMemberValue(Pair pair) {
+ String name = pool.getUtf8Info(pair.name);
+ if (members == null)
+ members = new LinkedHashMap();
+
+ members.put(name, pair);
+ }
+
+ /**
+ * Returns a string representation of the annotation.
+ */
+ public String toString() {
+ StringBuffer buf = new StringBuffer("@");
+ buf.append(getTypeName());
+ if (members != null) {
+ buf.append("(");
+ Iterator mit = members.keySet().iterator();
+ while (mit.hasNext()) {
+ String name = (String)mit.next();
+ buf.append(name).append("=").append(getMemberValue(name));
+ if (mit.hasNext())
+ buf.append(", ");
+ }
+ buf.append(")");
+ }
+
+ return buf.toString();
+ }
+
+ /**
+ * Obtains the name of the annotation type.
+ *
+ * @return the type name
+ */
+ public String getTypeName() {
+ return Descriptor.toClassName(pool.getUtf8Info(typeIndex));
+ }
+
+ /**
+ * Obtains all the member names.
+ *
+ * @return null if no members are defined.
+ */
+ public Set getMemberNames() {
+ if (members == null)
+ return null;
+ else
+ return members.keySet();
+ }
+
+ /**
+ * Obtains the member value with the given name.
+ *
+ * <p>If this annotation does not have a value for the
+ * specified member,
+ * this method returns null. It does not return a
+ * <code>MemberValue</code> with the default value.
+ * The default value can be obtained from the annotation type.
+ *
+ * @param name the member name
+ * @return null if the member cannot be found or if the value is
+ * the default value.
+ *
+ * @see javassist.bytecode.AnnotationDefaultAttribute
+ */
+ public MemberValue getMemberValue(String name) {
+ if (members == null)
+ return null;
+ else {
+ Pair p = (Pair)members.get(name);
+ if (p == null)
+ return null;
+ else
+ return p.value;
+ }
+ }
+
+ /**
+ * Constructs an annotation-type object representing this annotation.
+ * For example, if this annotation represents <code>@Author</code>,
+ * this method returns an <code>Author</code> object.
+ *
+ * @param cl class loader for loading an annotation type.
+ * @param cp class pool for obtaining class files.
+ * @return the annotation
+ * @throws ClassNotFoundException if the class cannot found.
+ * @throws NoSuchClassError if the class linkage fails.
+ */
+ public Object toAnnotationType(ClassLoader cl, ClassPool cp)
+ throws ClassNotFoundException, NoSuchClassError
+ {
+ return AnnotationImpl.make(cl,
+ MemberValue.loadClass(cl, getTypeName()),
+ cp, this);
+ }
+
+ /**
+ * Writes this annotation.
+ *
+ * @param writer the output.
+ * @throws IOException for an error during the write
+ */
+ public void write(AnnotationsWriter writer) throws IOException {
+ String typeName = pool.getUtf8Info(typeIndex);
+ if (members == null) {
+ writer.annotation(typeName, 0);
+ return;
+ }
+
+ writer.annotation(typeName, members.size());
+ Iterator it = members.values().iterator();
+ while (it.hasNext()) {
+ Pair pair = (Pair)it.next();
+ writer.memberValuePair(pair.name);
+ pair.value.write(writer);
+ }
+ }
+
+ /**
+ * Returns true if the given object represents the same annotation
+ * as this object. The equality test checks the member values.
+ */
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof Annotation == false)
+ return false;
+
+ Annotation other = (Annotation) obj;
+
+ if (getTypeName().equals(other.getTypeName()) == false)
+ return false;
+
+ LinkedHashMap otherMembers = other.members;
+ if (members == otherMembers)
+ return true;
+ else if (members == null)
+ return otherMembers == null;
+ else
+ if (otherMembers == null)
+ return false;
+ else
+ return members.equals(otherMembers);
+ }
+}
Deleted: tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectInputStream.java
===================================================================
--- trunk/src/main/javassist/util/proxy/ProxyObjectInputStream.java 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectInputStream.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,82 +0,0 @@
-package javassist.util.proxy;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamClass;
-
-/**
- * An input stream class which knows how to deserialize proxies created via {@link ProxyFactory} and
- * serializedo via a {@link ProxyObjectOutputStream}. It must be used when deserialising proxies created
- * from a proxy factory configured with {@link ProxyFactory#useWriteReplace} set to false.
- */
-public class ProxyObjectInputStream extends ObjectInputStream
-{
- /**
- * create an input stream which can be used to deserialize an object graph which includes proxies created
- * using class ProxyFactory. the classloader used to resolve proxy superclass and interface names
- * read from the input stream will default to the current thread's context class loader or the system
- * classloader if the context class loader is null.
- * @param in
- * @throws java.io.StreamCorruptedException whenever ObjectInputStream would also do so
- * @throws IOException whenever ObjectInputStream would also do so
- * @throws SecurityException whenever ObjectInputStream would also do so
- * @throws NullPointerException if in is null
- */
- public ProxyObjectInputStream(InputStream in) throws IOException
- {
- super(in);
- loader = Thread.currentThread().getContextClassLoader();
- if (loader == null) {
- loader = ClassLoader.getSystemClassLoader();
- }
- }
-
- /**
- * Reset the loader to be
- * @param loader
- */
- public void setClassLoader(ClassLoader loader)
- {
- if (loader != null) {
- this.loader = loader;
- } else {
- loader = ClassLoader.getSystemClassLoader();
- }
- }
-
- protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
- boolean isProxy = readBoolean();
- if (isProxy) {
- String name = (String)readObject();
- Class superClass = loader.loadClass(name);
- int length = readInt();
- Class[] interfaces = new Class[length];
- for (int i = 0; i < length; i++) {
- name = (String)readObject();
- interfaces[i] = loader.loadClass(name);
- }
- length = readInt();
- byte[] signature = new byte[length];
- read(signature);
- ProxyFactory factory = new ProxyFactory();
- // we must always use the cache and never use writeReplace when using
- // ProxyObjectOutputStream and ProxyObjectInputStream
- factory.setUseCache(true);
- factory.setUseWriteReplace(false);
- factory.setSuperclass(superClass);
- factory.setInterfaces(interfaces);
- Class proxyClass = factory.createClass(signature);
- return ObjectStreamClass.lookup(proxyClass);
- } else {
- return super.readClassDescriptor();
- }
- }
-
- /**
- * the loader to use to resolve classes for proxy superclass and interface names read
- * from the stream. defaults to the context class loader of the thread which creates
- * the input stream or the system class loader if the context class loader is null.
- */
- private ClassLoader loader;
-}
\ No newline at end of file
Copied: tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectInputStream.java (from rev 528, trunk/src/main/javassist/util/proxy/ProxyObjectInputStream.java)
===================================================================
--- tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectInputStream.java (rev 0)
+++ tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectInputStream.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,99 @@
+/*
+ * Javassist, a Java-bytecode translator toolkit.
+ * Copyright (C) 1999-2010 Shigeru Chiba. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. Alternatively, the contents of this file may be used under
+ * the terms of the GNU Lesser General Public License Version 2.1 or later.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ */
+
+package javassist.util.proxy;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+
+/**
+ * An input stream class which knows how to deserialize proxies created via {@link ProxyFactory} and
+ * serializedo via a {@link ProxyObjectOutputStream}. It must be used when deserialising proxies created
+ * from a proxy factory configured with {@link ProxyFactory#useWriteReplace} set to false.
+ *
+ * @author Andrew Dinn
+ */
+public class ProxyObjectInputStream extends ObjectInputStream
+{
+ /**
+ * create an input stream which can be used to deserialize an object graph which includes proxies created
+ * using class ProxyFactory. the classloader used to resolve proxy superclass and interface names
+ * read from the input stream will default to the current thread's context class loader or the system
+ * classloader if the context class loader is null.
+ * @param in
+ * @throws java.io.StreamCorruptedException whenever ObjectInputStream would also do so
+ * @throws IOException whenever ObjectInputStream would also do so
+ * @throws SecurityException whenever ObjectInputStream would also do so
+ * @throws NullPointerException if in is null
+ */
+ public ProxyObjectInputStream(InputStream in) throws IOException
+ {
+ super(in);
+ loader = Thread.currentThread().getContextClassLoader();
+ if (loader == null) {
+ loader = ClassLoader.getSystemClassLoader();
+ }
+ }
+
+ /**
+ * Reset the loader to be
+ * @param loader
+ */
+ public void setClassLoader(ClassLoader loader)
+ {
+ if (loader != null) {
+ this.loader = loader;
+ } else {
+ loader = ClassLoader.getSystemClassLoader();
+ }
+ }
+
+ protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
+ boolean isProxy = readBoolean();
+ if (isProxy) {
+ String name = (String)readObject();
+ Class superClass = loader.loadClass(name);
+ int length = readInt();
+ Class[] interfaces = new Class[length];
+ for (int i = 0; i < length; i++) {
+ name = (String)readObject();
+ interfaces[i] = loader.loadClass(name);
+ }
+ length = readInt();
+ byte[] signature = new byte[length];
+ read(signature);
+ ProxyFactory factory = new ProxyFactory();
+ // we must always use the cache and never use writeReplace when using
+ // ProxyObjectOutputStream and ProxyObjectInputStream
+ factory.setUseCache(true);
+ factory.setUseWriteReplace(false);
+ factory.setSuperclass(superClass);
+ factory.setInterfaces(interfaces);
+ Class proxyClass = factory.createClass(signature);
+ return ObjectStreamClass.lookup(proxyClass);
+ } else {
+ return super.readClassDescriptor();
+ }
+ }
+
+ /**
+ * the loader to use to resolve classes for proxy superclass and interface names read
+ * from the stream. defaults to the context class loader of the thread which creates
+ * the input stream or the system class loader if the context class loader is null.
+ */
+ private ClassLoader loader;
+}
\ No newline at end of file
Deleted: tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectOutputStream.java
===================================================================
--- trunk/src/main/javassist/util/proxy/ProxyObjectOutputStream.java 2010-04-13 09:00:47 UTC (rev 527)
+++ tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectOutputStream.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -1,54 +0,0 @@
-package javassist.util.proxy;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.io.OutputStream;
-
-/**
- * An input stream class which knows how to serialize proxies created via {@link ProxyFactory}. It must
- * be used when serialising proxies created from a proxy factory configured with
- * {@link ProxyFactory#useWriteReplace} set to false. Subsequent deserialization of the serialized data
- * must employ a {@link ProxyObjectInputStream}
- */
-public class ProxyObjectOutputStream extends ObjectOutputStream
-{
- /**
- * create an output stream which can be used to serialize an object graph which includes proxies created
- * using class ProxyFactory
- * @param out
- * @throws IOException whenever ObjectOutputStream would also do so
- * @throws SecurityException whenever ObjectOutputStream would also do so
- * @throws NullPointerException if out is null
- */
- public ProxyObjectOutputStream(OutputStream out) throws IOException
- {
- super(out);
- }
-
- protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
- Class cl = desc.forClass();
- if (ProxyFactory.isProxyClass(cl)) {
- writeBoolean(true);
- Class superClass = cl.getSuperclass();
- Class[] interfaces = cl.getInterfaces();
- byte[] signature = ProxyFactory.getFilterSignature(cl);
- String name = superClass.getName();
- writeObject(name);
- // we don't write the marker interface ProxyObject
- writeInt(interfaces.length - 1);
- for (int i = 0; i < interfaces.length; i++) {
- Class interfaze = interfaces[i];
- if (interfaze != ProxyObject.class) {
- name = interfaces[i].getName();
- writeObject(name);
- }
- }
- writeInt(signature.length);
- write(signature);
- } else {
- writeBoolean(false);
- super.writeClassDescriptor(desc);
- }
- }
-}
Copied: tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectOutputStream.java (from rev 528, trunk/src/main/javassist/util/proxy/ProxyObjectOutputStream.java)
===================================================================
--- tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectOutputStream.java (rev 0)
+++ tags/rel_3_12_0_ga/src/main/javassist/util/proxy/ProxyObjectOutputStream.java 2010-04-15 16:22:14 UTC (rev 533)
@@ -0,0 +1,71 @@
+/*
+ * Javassist, a Java-bytecode translator toolkit.
+ * Copyright (C) 1999-2010 Shigeru Chiba. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. Alternatively, the contents of this file may be used under
+ * the terms of the GNU Lesser General Public License Version 2.1 or later.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ */
+
+package javassist.util.proxy;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.OutputStream;
+
+/**
+ * An input stream class which knows how to serialize proxies created via {@link ProxyFactory}. It must
+ * be used when serialising proxies created from a proxy factory configured with
+ * {@link ProxyFactory#useWriteReplace} set to false. Subsequent deserialization of the serialized data
+ * must employ a {@link ProxyObjectInputStream}
+ *
+ * @author Andrew Dinn
+ */
+public class ProxyObjectOutputStream extends ObjectOutputStream
+{
+ /**
+ * create an output stream which can be used to serialize an object graph which includes proxies created
+ * using class ProxyFactory
+ * @param out
+ * @throws IOException whenever ObjectOutputStream would also do so
+ * @throws SecurityException whenever ObjectOutputStream would also do so
+ * @throws NullPointerException if out is null
+ */
+ public ProxyObjectOutputStream(OutputStream out) throws IOException
+ {
+ super(out);
+ }
+
+ protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
+ Class cl = desc.forClass();
+ if (ProxyFactory.isProxyClass(cl)) {
+ writeBoolean(true);
+ Class superClass = cl.getSuperclass();
+ Class[] interfaces = cl.getInterfaces();
+ byte[] signature = ProxyFactory.getFilterSignature(cl);
+ String name = superClass.getName();
+ writeObject(name);
+ // we don't write the marker interface ProxyObject
+ writeInt(interfaces.length - 1);
+ for (int i = 0; i < interfaces.length; i++) {
+ Class interfaze = interfaces[i];
+ if (interfaze != ProxyObject.class) {
+ name = interfaces[i].getName();
+ writeObject(name);
+ }
+ }
+ writeInt(signature.length);
+ write(signature);
+ } else {
+ writeBoolean(false);
+ super.writeClassDescriptor(desc);
+ }
+ }
+}
More information about the jboss-cvs-commits
mailing list