I have this:
public interface Receiver extends x.y.a
{
public static abstract class Stub extends x.y.b implements Receiver
{
public Stub()
{
}
}
}
and want to write this:
private final Receiver receiver = new Receiver.Stub()
{
};
using reflection. Is that even possible? I can find the Stub() constuctor, but of course it fails to execute on its own.
No that is not possible, you will get exception if you try to instantiate abstract class through reflection. Whatever is the case always remember you cannot instantiate abstract class. Though you can create anonymous class.