]> source.dussan.org Git - javassist.git/commitdiff
fixes for JASSIST-42 and JASSIST-97
authoradinn <adinn@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Mon, 12 Apr 2010 08:13:58 +0000 (08:13 +0000)
committeradinn <adinn@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Mon, 12 Apr 2010 08:13:58 +0000 (08:13 +0000)
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@525 30ef5769-5b8d-40dd-aea6-55b5d6557bb3

build.xml
src/main/javassist/util/proxy/ProxyFactory.java

index 470601371a0d4e8712abdb3ceb52e9436cb9e6b3..315c746031c738505ae681ed318bfc27cac9bb40 100644 (file)
--- a/build.xml
+++ b/build.xml
     </junit>
   </target>
 
-  <target name="foo" depends="test-compile">
-    <junit fork="true" showoutput="true">
-      <classpath refid="test.classpath"/>
-      <test name="test.javassist.proxy.ProxyFactoryCompatibilityTest"/>
-      <jvmarg value="-Xdebug"/>
-      <jvmarg  value="-Xnoagent"/>
-      <jvmarg  value="-Djava.compiler=NONE"/>
-      <jvmarg  value="-Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=5005"/>
-    </junit>
-  </target>
-
   <target name="sample" depends="compile">
     <javac srcdir="${basedir}"
            destdir="${build.classes.dir}"
index e407778af6e29f70767ff73b260618b6267ec674..21e39d4cddb087f2378de3af182a085ee106a04b 100644 (file)
@@ -410,7 +410,7 @@ public class ProxyFactory {
      */
     Class createClass(byte[] signature)
     {
-        this.signature = signature;
+        installSignature(signature);
         return createClass1();
     }
 
@@ -764,13 +764,19 @@ public class ProxyFactory {
         }
     };
 
-    private void computeSignature(MethodFilter filter) // throws CannotCompileException
+    private void makeSortedMethodList()
     {
         checkClassAndSuperName();
 
         HashMap allMethods = getMethods(superClass, interfaces);
         signatureMethods = new ArrayList(allMethods.entrySet());
         Collections.sort(signatureMethods, sorter);
+    }
+
+    private void computeSignature(MethodFilter filter) // throws CannotCompileException
+    {
+        makeSortedMethodList();
+
         int l = signatureMethods.size();
         int maxBytes = ((l + 7) >> 3);
         signature = new byte[maxBytes];
@@ -786,6 +792,19 @@ public class ProxyFactory {
         }
     }
 
+    private void installSignature(byte[] signature) // throws CannotCompileException
+    {
+        makeSortedMethodList();
+
+        int l = signatureMethods.size();
+        int maxBytes = ((l + 7) >> 3);
+        if (signature.length != maxBytes) {
+            throw new RuntimeException("invalid filter signature length for deserialized proxy class");
+        }
+
+        this.signature =  signature;
+    }
+
     private boolean testBit(byte[] signature, int idx)
     {
         int byteIdx = idx >> 3;
@@ -887,12 +906,10 @@ public class ProxyFactory {
             String key = (String)e.getKey();
             Method meth = (Method)e.getValue();
             int mod = meth.getModifiers();
-            if (!Modifier.isFinal(mod) && !Modifier.isStatic(mod)
-                && isVisible(mod, packageName, meth))
-                if (testBit(signature, index))
-                    if (methodFilter == null || methodFilter.isHandled(meth))
-                        override(className, meth, prefix, index,
-                                 keyToDesc(key), cf, cp);
+            if (testBit(signature, index)) {
+                override(className, meth, prefix, index,
+                        keyToDesc(key), cf, cp);
+            }
             index++;
         }