[jboss-cvs] javassist SVN: r650 - in branches/3_12_0_SP: src/main/javassist/util/proxy and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Sep 13 23:24:12 EDT 2012
Author: soul2zimate
Date: 2012-09-13 23:24:12 -0400 (Thu, 13 Sep 2012)
New Revision: 650
Modified:
branches/3_12_0_SP/build.xml
branches/3_12_0_SP/pom.xml
branches/3_12_0_SP/src/main/javassist/util/proxy/ProxyFactory.java
branches/3_12_0_SP/src/test/test/javassist/proxy/ProxySerializationTest.java
Log:
JBPAPP-9336(Upgrade to Javassist 3.16), 3-12-service-pack
Modified: branches/3_12_0_SP/build.xml
===================================================================
--- branches/3_12_0_SP/build.xml 2012-09-14 03:01:21 UTC (rev 649)
+++ branches/3_12_0_SP/build.xml 2012-09-14 03:24:12 UTC (rev 650)
@@ -6,7 +6,7 @@
<project name="javassist" default="jar" basedir=".">
- <property name="dist-version" value="javassist-3.12.GA"/>
+ <property name="dist-version" value="javassist-3.12.SP"/>
<property environment="env"/>
<property name="target.jar" value="javassist.jar"/>
Modified: branches/3_12_0_SP/pom.xml
===================================================================
--- branches/3_12_0_SP/pom.xml 2012-09-14 03:01:21 UTC (rev 649)
+++ branches/3_12_0_SP/pom.xml 2012-09-14 03:24:12 UTC (rev 650)
@@ -8,7 +8,7 @@
<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>
+ <version>3.12.0.SP</version>
<name>Javassist</name>
<url>http://www.javassist.org/</url>
<distributionManagement>
Modified: branches/3_12_0_SP/src/main/javassist/util/proxy/ProxyFactory.java
===================================================================
--- branches/3_12_0_SP/src/main/javassist/util/proxy/ProxyFactory.java 2012-09-14 03:01:21 UTC (rev 649)
+++ branches/3_12_0_SP/src/main/javassist/util/proxy/ProxyFactory.java 2012-09-14 03:24:12 UTC (rev 650)
@@ -27,6 +27,7 @@
import javassist.CannotCompileException;
import javassist.bytecode.*;
+import javassist.tools.rmi.Proxy;
/*
* This class is implemented only with the lower-level API of Javassist.
@@ -155,6 +156,7 @@
private MethodFilter methodFilter;
private MethodHandler handler; // retained for legacy usage
private List signatureMethods;
+ private boolean hasGetHandler; // Modification for 'service pack' in 3.12 in order to replicate bug fix in 3.16
private byte[] signature;
private String classname;
private String basename;
@@ -198,6 +200,9 @@
private static final String HANDLER_GETTER = "getHandler";
private static final String HANDLER_GETTER_TYPE = "()" + HANDLER_TYPE;
+ // Handler getter key modification for SP.
+ private static final String HANDLER_GETTER_KEY = HANDLER_GETTER + ":()";
+
private static final String SERIAL_VERSION_UID_FIELD = "serialVersionUID";
private static final String SERIAL_VERSION_UID_TYPE = "J";
private static final int SERIAL_VERSION_UID_VALUE = -1;
@@ -337,6 +342,7 @@
handler = null;
signature = null;
signatureMethods = null;
+ hasGetHandler = false; // Default boolean value.
thisClass = null;
writeDirectory = null;
factoryUseCache = useCache;
@@ -683,7 +689,7 @@
private ClassFile make() throws CannotCompileException {
ClassFile cf = new ClassFile(false, classname, superName);
cf.setAccessFlags(AccessFlag.PUBLIC);
- setInterfaces(cf, interfaces);
+ setInterfaces(cf, interfaces, hasGetHandler ? Proxy.class : ProxyObject.class);
ConstPool pool = cf.getConstPool();
// legacy: we only add the static field for the default interceptor if caching is disabled
@@ -714,8 +720,9 @@
int s = overrideMethods(cf, pool, classname);
addMethodsHolder(cf, pool, classname, s);
addSetter(classname, cf, pool);
- addGetter(classname, cf, pool);
+ if (!hasGetHandler) addGetter(classname, cf, pool);
+
if (factoryWriteReplace) {
try {
cf.addMethod(makeWriteReplace(pool));
@@ -773,6 +780,9 @@
HashMap allMethods = getMethods(superClass, interfaces);
signatureMethods = new ArrayList(allMethods.entrySet());
+
+ // Make a check whether or not there exist any methods with the signature 'getHandler'
+ hasGetHandler = (allMethods.get(HANDLER_GETTER_KEY) != null);
Collections.sort(signatureMethods, sorter);
}
@@ -832,8 +842,9 @@
}
}
- private static void setInterfaces(ClassFile cf, Class[] interfaces) {
- String setterIntf = ProxyObject.class.getName();
+ private static void setInterfaces(ClassFile cf, Class[] interfaces, Class proxyClass)
+ {
+ String setterIntf = proxyClass.getName();
String[] list;
if (interfaces == null || interfaces.length == 0)
list = new String[] { setterIntf };
Modified: branches/3_12_0_SP/src/test/test/javassist/proxy/ProxySerializationTest.java
===================================================================
--- branches/3_12_0_SP/src/test/test/javassist/proxy/ProxySerializationTest.java 2012-09-14 03:01:21 UTC (rev 649)
+++ branches/3_12_0_SP/src/test/test/javassist/proxy/ProxySerializationTest.java 2012-09-14 03:24:12 UTC (rev 650)
@@ -1,5 +1,6 @@
package test.javassist.proxy;
+import com.sun.tools.doclets.formats.html.SourceToHTMLConverter;
import javassist.util.proxy.*;
import junit.framework.TestCase;
@@ -30,8 +31,8 @@
try {
String name = "proxytest_1";
- Constructor constructor = proxyClass.getConstructor(String.class);
- TestClass proxy = (TestClass)constructor.newInstance(name);
+ Constructor constructor = proxyClass.getConstructor(new Class[] {String.class});
+ TestClass proxy = (TestClass)constructor.newInstance(new Object[] {name});
((ProxyObject)proxy).setHandler(handler);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bos);
@@ -57,8 +58,8 @@
try {
String name = "proxytest_2";
- Constructor constructor = proxyClass.getConstructor(String.class);
- TestClass proxy = (TestClass)constructor.newInstance(name);
+ Constructor constructor = proxyClass.getConstructor(new Class[] {String.class});
+ TestClass proxy = (TestClass)constructor.newInstance(new Object[] {name});
((ProxyObject)proxy).setHandler(handler);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ProxyObjectOutputStream out = new ProxyObjectOutputStream(bos);
More information about the jboss-cvs-commits
mailing list