git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@448 30ef5769-5b8d-40dd-aea6-55b5d6557bb3tags/rel_3_17_1_ga
@@ -281,6 +281,11 @@ see javassist.Dump. | |||
<h2>Changes</h2> | |||
<p>-version 3.8.1 | |||
<ul> | |||
<li>CtClass.rebuildClassFile() has been added. | |||
</ul> | |||
<p>-version 3.8.0 on June 13, 2008 | |||
<ul> | |||
<li>javassist.bytecode.analysis was implemented. |
@@ -180,14 +180,13 @@ Copyright (C) 1999-2008 Shigeru Chiba. All Rights Reserved.</i>]]></bottom> | |||
<delete file="${dist-version}.zip"/> | |||
<zip zipfile="${dist-version}.zip"> | |||
<zipfileset dir="${basedir}" prefix="${dist-version}"> | |||
<include name="**"/> | |||
<exclude name=".*"/> | |||
<exclude name=".*/**"/> | |||
<exclude name="build/**"/> | |||
<exclude name="local/**"/> | |||
<exclude name="eclipse-output/**"/> | |||
<exclude name="${dist-version}.zip"/> | |||
<exclude name="${target-src.jar}"/> | |||
<include name="html/**"/> | |||
<include name="sample/**"/> | |||
<include name="src/**"/> | |||
<include name="tutorial/**"/> | |||
<include name="*.html"/> | |||
<include name="*.xml"/> | |||
<include name="${target.jar}"/> | |||
</zipfileset> | |||
</zip> | |||
</target> |
@@ -1,13 +1,8 @@ | |||
<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"> | |||
<parent> | |||
<groupId>org.jboss</groupId> | |||
<artifactId>jboss-parent</artifactId> | |||
<version>3</version> | |||
</parent> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.jboss</groupId> | |||
<groupId>javassist</groupId> | |||
<artifactId>javassist</artifactId> | |||
<packaging>jar</packaging> | |||
<description>Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation | |||
@@ -89,17 +84,6 @@ | |||
</dependencies> | |||
</profile> | |||
</profiles> | |||
<repositories> | |||
<repository> | |||
<id>repository.jboss.org</id> | |||
<name>JBoss Inc. Repository</name> | |||
<layout>default</layout> | |||
<url>http://repository.jboss.org/maven2/</url> | |||
<snapshots> | |||
<enabled>false</enabled> | |||
</snapshots> | |||
</repository> | |||
</repositories> | |||
<dependencies> | |||
<dependency> | |||
<groupId>junit</groupId> |
@@ -362,6 +362,7 @@ public abstract class CtBehavior extends CtMember { | |||
methodInfo.setAccessFlags(methodInfo.getAccessFlags() | |||
& ~AccessFlag.ABSTRACT); | |||
methodInfo.rebuildStackMapIf6(cc.getClassPool(), cc.getClassFile2()); | |||
declaringClass.rebuildClassFile(); | |||
} | |||
catch (CompileError e) { | |||
throw new CannotCompileException(e); | |||
@@ -396,6 +397,7 @@ public abstract class CtBehavior extends CtMember { | |||
destInfo.setAccessFlags(destInfo.getAccessFlags() | |||
& ~AccessFlag.ABSTRACT); | |||
destClass.rebuildClassFile(); | |||
} | |||
/** |
@@ -1155,7 +1155,7 @@ public abstract class CtClass { | |||
public boolean stopPruning(boolean stop) { return true; } | |||
/** | |||
* Discards unnecessary attributes, in particuar, | |||
* 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. | |||
@@ -1191,6 +1191,21 @@ public abstract class CtClass { | |||
*/ | |||
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 |
@@ -60,7 +60,7 @@ class CtClassType extends CtClass { | |||
boolean wasChanged; | |||
private boolean wasFrozen; | |||
boolean wasPruned; | |||
boolean memberRemoved; | |||
boolean gcConstPool; // if true, the constant pool entries will be garbage collected. | |||
ClassFile classfile; | |||
byte[] rawClassfile; // backup storage | |||
@@ -78,7 +78,7 @@ class CtClassType extends CtClass { | |||
CtClassType(String name, ClassPool cp) { | |||
super(name); | |||
classPool = cp; | |||
wasChanged = wasFrozen = wasPruned = memberRemoved = false; | |||
wasChanged = wasFrozen = wasPruned = gcConstPool = false; | |||
classfile = null; | |||
rawClassfile = null; | |||
memberCache = null; | |||
@@ -1183,7 +1183,7 @@ class CtClassType extends CtClass { | |||
ClassFile cf = getClassFile2(); | |||
if (cf.getFields().remove(fi)) { | |||
getMembers().remove(f); | |||
memberRemoved = true; | |||
gcConstPool = true; | |||
} | |||
else | |||
throw new NotFoundException(f.toString()); | |||
@@ -1220,7 +1220,7 @@ class CtClassType extends CtClass { | |||
ClassFile cf = getClassFile2(); | |||
if (cf.getMethods().remove(mi)) { | |||
getMembers().remove(m); | |||
memberRemoved = true; | |||
gcConstPool = true; | |||
} | |||
else | |||
throw new NotFoundException(m.toString()); | |||
@@ -1243,7 +1243,7 @@ class CtClassType extends CtClass { | |||
ClassFile cf = getClassFile2(); | |||
if (cf.getMethods().remove(mi)) { | |||
getMembers().remove(m); | |||
memberRemoved = true; | |||
gcConstPool = true; | |||
} | |||
else | |||
throw new NotFoundException(m.toString()); | |||
@@ -1302,6 +1302,8 @@ class CtClassType extends CtClass { | |||
getClassFile2().prune(); | |||
} | |||
public void rebuildClassFile() { gcConstPool = true; } | |||
public void toBytecode(DataOutputStream out) | |||
throws CannotCompileException, IOException | |||
{ | |||
@@ -1309,9 +1311,9 @@ class CtClassType extends CtClass { | |||
if (isModified()) { | |||
checkPruned("toBytecode"); | |||
ClassFile cf = getClassFile2(); | |||
if (memberRemoved) { | |||
if (gcConstPool) { | |||
cf.compact(); | |||
memberRemoved = false; | |||
gcConstPool = false; | |||
} | |||
modifyClassConstructor(cf); |