Martin Kouba ClientProxyPrivateMethodsTest looks ok from the code standpoint. It may differ from the deployment / environment standpoint as in my use case, the retrieval of the contextual reference is triggered in the MetricsExtension that is a separate bundle than the bundle that contains the MetricRegistry class.
To reproduce the issue with the MetricsSampleTest test, you need to change the scope as you did, and then run the sample into Karaf by running mvn test -pl envs/osgi/ -Dtest=MetricsPaxExamTest. That executes the same sample into Karaf / OSGi.
It may be that these issues are environment related. OSGi, as being more constrained when it comes to class loading, is more sensitive to class proxying issue. Still, I fail to see why the "private nested class" (and the "Package-private class") should not work with OSGi class loading mechanism.
|