I have class Assembly implementing IAssembly.
I see following error when starting the application
Caused by: java.lang.IllegalAccessError: class <Assembly > cannot access its superinterface <IAssembly>
at java.lang.ClassLoader.defineClass1(Native Method)
Assembly code
class package.Assembly implements IAssembly {
}
IAssembly
interface IAssembly { //note -this is not public, so uses default protected
}
Assembly and IAssembly exists in two different jars. Both jars loaded by different classloaders. The Assembly class is loaded in child classloader, IAssembly is parent. Class loaders are using chaining.
In normal cases, this works. The error occurs when I run my application after instrumenting jars using cobertura. With out instrumentation all works fine. Could cobertura instrumentation cause such error? Or This is an error anyway waiting to be detected, but with cobertura the error is quickly exposed.
By making the interface 'public' the error goes away.
package_example
was defined like this:A/package_example/classA
,B/package_example/classB
. Of course, bothA
andB
have to be in the classpath for this to work. – Pralltriller