Browse Source

fixes for JASSIST-42 and JASSIST-97

git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@525 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
tags/rel_3_17_1_ga
adinn 14 years ago
parent
commit
aafe4b1a09
2 changed files with 25 additions and 19 deletions
  1. 0
    11
      build.xml
  2. 25
    8
      src/main/javassist/util/proxy/ProxyFactory.java

+ 0
- 11
build.xml View File

@@ -104,17 +104,6 @@
</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}"

+ 25
- 8
src/main/javassist/util/proxy/ProxyFactory.java View 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++;
}


Loading…
Cancel
Save