Reputation: 419
I have a situation: Class B in it's own Bundle (say Bundle-B-1.0.0). Class A is in Bundle-A.1.0.0) and the relationship between A and B is:
public class B extends A {
public B(){
super();
}
}
I am trying to load class B in a different ClassLoader C that has visibility of Class A', which is same as Class-A but in a different(higher) version of Bundle-A.2.0.0.
When I create an instance of Class B (from same Bundle-B.1.0.0) using ClassLoader C and via Reflection, how do I ensure that it refers/uses class A' from Bundle-A.2.0.0 (the higher versioned bundle) when it calls super()?
The requirement that I am trying to fulfill is that Class B can/should be able to refer A or A' on demand during its own instantiation. Is this possible?
Upvotes: 0
Views: 256
Reputation: 23948
No this is not possible. Bundle B will be wired to import from either A or A' but you cannot dynamically switch between the two.
Upvotes: 1