I came accross the friend package pattern described here: http://wiki.apidesign.org/wiki/APIDesignPatterns:FriendPackages
I simply implemented the example but it does not work for me. I always get the error
IllegalStateException: Something is wrong: null
The error is thrown in the Accessor class.
The example tells that creating a new object is done by calling
Item item = Accessor.getDefault().newItem();
But neither Accessor.setDefault(Accessor) will be called nor the static initialization block will be called.
static {
Accessor.setDefault(new AccessorImpl());
}
How should this work?