Details
-
Type:
Sub-task
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.8.0
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
We have a class loader like this:
class ParentOnlyClassLoader extends ClassLoader{ ParentOnlyClassLoader(ClassLoader parent) { super(parent) } @Override protected Class<?> findClass(String name) { parent.findClass(name) } }
When this class is compiled with JDK 1.5 then executed in JDK 1.6 you get the error:
java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.ClassLoader do not match. Expected 2 but got 3 at org.grails.plugins.tomcat.ParentOnlyClassLoader.<init>(ParentOnlyClassLoader.groovy:28) at org
the important part is not so much waht exact constructors there are in ParentOnlyClassLoader, but what there is in java.lang.ClassLoader. As it seems, at elast on some JDKs, there is an additional private constructor that wrongly gets included here. If we fix that part, then all code compiled with 1.8.0 and before may have a problem. Also it is no final solution. Should the parent class gain a new non-private constructor, for example because of refactoring, this problem will reappear