title: Get bundle classes of private packages in another bundle
body: <p>I have two osgi bundles A and B. All packages of bundle A are private. In bundle B I used the code from <a href="https://stackoverflow.com/a/22800118/5057736">https://stackoverflow.com/a/22800118/5057736</a>:</p>
  
  <p>BundleA</p>
  
  <pre><code>class ClassA extends ClassB{
      ClassA(){
        super(ClassA.class);
      }
  }
  </code></pre>
  
  <p>Bundle B</p>
  
  <pre><code>class ClassB{
  ...
  public void doFoo(){
  { 
  Bundle bundle = FrameworkUtil.getBundle(ClassAReference);  
  BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
  // Getting all the class files (also from imported packages)
  Collection&lt;String&gt; resources = bundleWiring.listResources("/", "*.class", BundleWiring.LISTRESOURCES_RECURSE);
  
  List&lt;String&gt; classNamesOfCurrentBundle = new ArrayList&lt;String&gt;();
  for (String resource : resources) {
      URL localResource = bundle.getEntry(resource);
      // Bundle.getEntry() returns null if the resource is not located in the specific bundle
      if (localResource != null) {
          String className = resource.replaceAll("/", ".");
          classNamesOfCurrentBundle.add(className);
      }
  }
  </code></pre>
  
  <p>However, I get resources - all classes which bundle A classloader loaded. But I need only the classes which are inside bundle A. I mean I need classes which belong to bundle A. To get them as I understand I need localResource. However,localResource is always null, but the classes are exactly in bundle A - for example ClassA . How to get classes which belong to bundle A in ClassB?</p>