Dynamic implementation class of a subInterface is loaded with the classloader of the dynamic implementaion of the superInterface.

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@504216 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2007-02-06 17:46:33 +00:00
parent 326df83bb2
commit c13e2baab7
1 changed files with 5 additions and 2 deletions

View File

@ -73,11 +73,15 @@ class InterfaceImplGenerator {
ClassLoader parentLoader = iface.getClassLoader(); ClassLoader parentLoader = iface.getClassLoader();
BCClassLoader loader = new BCClassLoader(_project, parentLoader); BCClassLoader loader = new BCClassLoader(_project, parentLoader);
BCClassLoader enhLoader = new BCClassLoader(_enhProject, parentLoader);
BCClass bc = _project.loadClass(getClassName(meta)); BCClass bc = _project.loadClass(getClassName(meta));
bc.declareInterface(iface); bc.declareInterface(iface);
ClassMetaData sup = meta.getPCSuperclassMetaData(); ClassMetaData sup = meta.getPCSuperclassMetaData();
if (sup != null) if (sup != null) {
bc.setSuperclass(sup.getInterfaceImpl()); bc.setSuperclass(sup.getInterfaceImpl());
enhLoader = new BCClassLoader(_enhProject,
sup.getInterfaceImpl().getClassLoader());
}
FieldMetaData[] fields = meta.getDeclaredFields(); FieldMetaData[] fields = meta.getDeclaredFields();
Set methods = new HashSet(); Set methods = new HashSet();
@ -103,7 +107,6 @@ class InterfaceImplGenerator {
if (result != PCEnhancer.ENHANCE_PC) if (result != PCEnhancer.ENHANCE_PC)
throw new InternalException(_loc.get("interface-badenhance", throw new InternalException(_loc.get("interface-badenhance",
iface)).setFatal(true); iface)).setFatal(true);
BCClassLoader enhLoader = new BCClassLoader(_enhProject, parentLoader);
try{ try{
// load the class for real. // load the class for real.
impl = Class.forName(bc.getName(), true, enhLoader); impl = Class.forName(bc.getName(), true, enhLoader);