[![Java CI with Maven](https://github.com/jboss-javassist/javassist/actions/workflows/maven.yml/badge.svg)](https://github.com/jboss-javassist/javassist/actions/workflows/maven.yml) Java bytecode engineering toolkit ### [Javassist version 3](http://www.javassist.org) Copyright (C) 1999-2022 by Shigeru Chiba, All rights reserved. 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. This software is distributed under the Mozilla Public License Version 1.1, the GNU Lesser General Public License Version 2.1 or later, or the Apache License Version 2.0. #### Files * [Readme.html](Readme.html) Readme file (a longer version of this file). * [Changes.md](Changes.md) Release notes. * [License.html](License.html) License file. * [tutorial/tutorial.html](https://www.javassist.org/tutorial/tutorial.html) Tutorial. * ./javassist.jar The Javassist jar file (class files). * ./src/main The source files * [Examples.md](Examples.md) How to run examples. * [html/index.html](https://www.javassist.org/html/index.html) The top page of the Javassist API document. #### Hints To print the version number, type this command: ``` java -jar javassist.jar ``` #### Acknowledgments The development of this software is sponsored in part by the PRESTO and CREST programs of [Japan Science and Technology Agency](http://www.jst.go.jp/). 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, Jason T. Greene, Omer Kaspi, and all other contributors for their contributions. by [Shigeru Chiba](https://github.com/chibash) e-source&id=cefc23a1324e1085182bedbff7528b5c6870d1e8'>plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<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>org.javassist</groupId>
  <artifactId>javassist</artifactId>
  <packaging>bundle</packaging>
  <description>
  	Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation
    simple.  It is a class library for editing bytecodes in Java.
  </description>
  <version>3.21.0-GA</version>
  <name>Javassist</name>
  <url>http://www.javassist.org/</url>

  <organization>
    <name>Shigeru Chiba, www.javassist.org</name>
  </organization>

  <issueManagement>
    <system>JIRA</system>
    <url>https://jira.jboss.org/jira/browse/JASSIST/</url>
  </issueManagement>
  <licenses>
    <!-- this is the license under which javassist is usually distributed
      -->
    <license>
      <name>MPL 1.1</name>
      <url>http://www.mozilla.org/MPL/MPL-1.1.html</url>
    </license>
    <!-- this is the license under which javassist is distributed when
	 it is bundled with JBoss
      -->
    <license>
      <name>LGPL 2.1</name>
      <url>http://www.gnu.org/licenses/lgpl-2.1.html</url>
    </license>
    <!-- this is the license under which javassist can be distributed.
      -->
    <license>
      <name>Apache License 2.0</name>
      <url>http://www.apache.org/licenses/</url>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:jboss-javassist/javassist.git</connection>
    <developerConnection>scm:git:git@github.com:jboss-javassist/javassist.git</developerConnection>
    <url>scm:git:git@github.com:jboss-javassist/javassist.git</url>
  </scm>

  <developers>
    <developer>
      <id>chiba</id>
      <name>Shigeru Chiba</name>
      <email>chiba@javassist.org</email>
      <organization>The Javassist Project</organization>
      <organizationUrl>http://www.javassist.org/</organizationUrl>
      <roles>
        <role>project lead</role>
      </roles>
      <timezone>9</timezone>
    </developer>

    <developer>
      <id>adinn</id>
      <name>Andrew Dinn</name>
      <email>adinn@redhat.com</email>
      <organization>JBoss</organization>
      <organizationUrl>http://www.jboss.org/</organizationUrl>
      <roles>
        <role>contributing developer</role>
      </roles>
      <timezone>0</timezone>
    </developer>

    <developer>
      <id>kabir.khan@jboss.com</id>
      <name>Kabir Khan</name>
      <email>kabir.khan@jboss.com</email>
      <organization>JBoss</organization>
      <organizationUrl>http://www.jboss.org/</organizationUrl>
      <roles>
        <role>contributing developer</role>
      </roles>
      <timezone>0</timezone>
    </developer>
    
    <developer>
      <id>scottmarlow</id>
      <name>Scott Marlow</name>
      <email>smarlow@redhat.com</email>
      <organization>JBoss</organization>
      <organizationUrl>http://www.jboss.org/</organizationUrl>
      <roles>
        <role>contributing developer</role>
      </roles>
      <timezone>-5</timezone>
    </developer>


  </developers>

  <distributionManagement>
  <!--  
      You need entries in your .m2/settings.xml like this:
   <servers>
    <server>
       <id>jboss-releases-repository</id>
       <username>your_jboss.org_username</username>
       <password>password</password>
    </server>
    <server>
       <id>jboss-snapshots-repository</id>
       <username>your_jboss.org_username</username>
       <password>password</password>
    </server>
  </servers>
  
  To deploy a snapshot, you need to run
  
  mvn deploy -Dversion=3.x.y-SNAPSHOT

  To deploy a release you need to change the version to 3.x.y.GA and run

  mvn deploy
    -->
    <repository>
      <id>jboss-releases-repository</id>
      <name>JBoss Releases Repository</name>
      <url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
    </repository>
    <snapshotRepository>
      <id>jboss-snapshots-repository</id>
      <name>JBoss Snapshots Repository</name>
      <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</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>
        <version>3.2</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
          <testSource>1.8</testSource>
          <testTarget>1.8</testTarget>
          <testCompilerArgument>-parameters</testCompilerArgument>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
          <includes>
            <include>javassist/JvstTest.java</include>
          </includes>
	  <forkMode>once</forkMode>
          <workingDirectory>runtest</workingDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <archive>
            <manifest>
              <mainClass>javassist.CtClass</mainClass>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
            </manifest>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.0.4</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
        <inherited>true</inherited>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.7</version>
	<configuration>
	  <attach>true</attach>
	</configuration>
      </plugin>
        <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.5.3</version>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <supportedProjectTypes>
            <supportedProjectType>jar</supportedProjectType>
            <supportedProjectType>bundle</supportedProjectType>
            <supportedProjectType>war</supportedProjectType>
          </supportedProjectTypes>
          <instructions>
            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
            <Bundle-Version>${project.version}</Bundle-Version>
            <Import-Package>!com.sun.jdi.*</Import-Package>	
            <Export-Package>!com.sun.jdi.*,javassist.*;version="${project.version}"</Export-Package>
          </instructions>
        </configuration>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <!-- profile for releasing to sonatype repo
	 exercise with mvn -PcentralRelease
      -->
    <profile>
      <id>centralRelease</id>
      <!-- obviously we need to use the Sonatype staging repo for upload -->
      <distributionManagement>
	<repository>
	  <id>sonatype-releases-repository</id>
	  <name>Sonatype Releases Repository</name>
	  <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
	</repository>
      </distributionManagement>
      <!-- we need to be able to sign the jars we install -->
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <configuration>
              <passphrase>${gpg.passphrase}</passphrase>
              <useAgent>${gpg.useAgent}</useAgent>
            </configuration>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <!-- profiles to add tools jar containing com.sun.jdi code
	 needed by sample code
	 -->
    <profile>
      <id>default-tools</id>
      <activation>
        <os>
          <family>!mac</family>
        </os>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sun</groupId>
          <artifactId>tools</artifactId>
          <version>${java.version}</version>
          <scope>system</scope>
          <optional>true</optional>
          <systemPath>${java.home}/../lib/tools.jar</systemPath>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>mac-tools</id>
      <activation>
        <os>
          <family>mac</family>
        </os>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sun</groupId>
          <artifactId>tools</artifactId>
          <version>${java.version}</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>