I have a plugin A which exports the package foo.bar. In the package foo.bar there is a abstract class FooBar with default scope members. In a plugin B I like to extend the FooBar within the same package and access the default scoped fields.
Plugin A manifest:
.
Bundle-SymbolicName: A
Export-Package: foo.bar
.
Plugin B manifest:
.
Bundle-SymbolicName: B
Require-Bundle: A
.
Class FooBar in Plugin A:
package foo.bar;
public abstract class FooBar{
int min = -1;
}
Class MyFooBar in Plugin B:
package foo.bar;
public class MyFooBar extends FooBar{
public void setMin(int min){
this.min = min;
}
}
The result:
..Caused by: java.lang.IllegalAccessError: tried to access field foo.bar.FooBar.min from class foo.bar.MyFooBar
In a normal java environment I can access package-scoped members if I define my class in the same package. Apparently this is not so in OSGI-Environment, is it??