There is still a big limitation with x-friends. x-friends exposes the
public types/members of an otherwise internal package to the friend plugin. However, you still cannot access non-public types/members, such as those declared protected or
package-private. (Note that "protected" also grants package-level visibility access, not just access to subclasses:
https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html). More precisely, you can't get package-level access.
So for example, if you have this code in the main plugin:
public class Foo {
protected void blah() {
}
}
with a plugin fragment you can write this code (if the code is in the same package as Foo):
new Foo().blah();
And, that case is very useful for writing tests.
However with x-friends it doesn't work. Note, you won't get an error in the IDE workbench! So it appears to work, but when you actually run the code, you get an IllegalAccessError. This is because OSGi considers a package from one bundle to be different from a package of another bundle, even if the package has the same name.