</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}"
*/
Class createClass(byte[] signature)
{
- this.signature = signature;
+ installSignature(signature);
return createClass1();
}
}
};
- 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];
}
}
+ 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;
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++;
}