aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoradinn <adinn@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2010-04-12 08:13:58 +0000
committeradinn <adinn@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2010-04-12 08:13:58 +0000
commitaafe4b1a09df7f0c94668875d38dddf2f05f5822 (patch)
tree20dacf731c2db6e06b9b1d76f5e1e9b851caa684 /src
parent604e8741298bcd2607936a1205bc746e367ea546 (diff)
downloadjavassist-aafe4b1a09df7f0c94668875d38dddf2f05f5822.tar.gz
javassist-aafe4b1a09df7f0c94668875d38dddf2f05f5822.zip
fixes for JASSIST-42 and JASSIST-97
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@525 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src')
-rw-r--r--src/main/javassist/util/proxy/ProxyFactory.java33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/main/javassist/util/proxy/ProxyFactory.java b/src/main/javassist/util/proxy/ProxyFactory.java
index e407778a..21e39d4c 100644
--- a/src/main/javassist/util/proxy/ProxyFactory.java
+++ b/src/main/javassist/util/proxy/ProxyFactory.java
@@ -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++;
}