<path id="test.compile.classpath">
<pathelement location="${build.classes.dir}"/>
<pathelement location="${lib.dir}/junit.jar"/>
+ <pathelement location="${lib.dir}/hamcrest.jar"/>
</path>
<property name="test.compile.classpath" refid="test.compile.classpath"/>
<path id="test.classpath">
<pathelement location="${test.build.dir}"/>
<pathelement location="${lib.dir}/junit.jar"/>
- <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${lib.dir}/hamcrest.jar"/>
+ <pathelement location="${build.classes.dir}"/>
</path>
<property name="test.classpath" refid="test.classpath"/>
import java.util.Hashtable;
import java.util.Vector;
+import javassist.bytecode.ClassFile;
+
/**
* The class loader for Javassist.
*
int i = name.lastIndexOf('.');
if (i != -1) {
String pname = name.substring(0, i);
- if (getDefinedPackage(pname) == null)
+ if (isDefinedPackage(pname))
try {
definePackage(
pname, null, null, null, null, null, null, null);
return defineClass(name, classfile, 0, classfile.length, domain);
}
+ private boolean isDefinedPackage(String name) {
+ if (ClassFile.MAJOR_VERSION >= ClassFile.JAVA_9)
+ return getDefinedPackage(name) == null;
+ else
+ return getPackage(name) == null;
+ }
+
protected Class<?> loadClassByDelegation(String name)
throws ClassNotFoundException
{