As far as I understood, the Class Adapter Pattern is about creating a class which extends multiple types so that it inherits at least one implementation and at least one interface not formerly directly implemented by the implementation to enable using the existing implementation via the interface.
This has been possible in Java, with the restriction that the Adapter can only inherit one implementation (class
) but inherit multiple interface
s (Compare with this answer). This limitation hasn’t changed in any way. You still can only inherit from one class
.
It is correct that interface
s can now have default
methods, but this doesn’t change the abstract
nature of an interface
and doesn’t make them eligible for conceptually bearing an implementation.
Even if an interface
contains only default
methods (no abstract
methods), you still can’t instantiate it without creating a new class
which implements the interface
. Such a strange interface
could only exist for primarily supporting the creation of Adapter classes which would then not be an example of the Class Adapter Pattern anymore, as that pattern is about combining formerly unrelated types, not types which were primarily designed for being combined.
In other words, in practice, when you encounter multiple implementation classes that you wish to combine in one Adapter, you will still face multiple class
es which you can’t combine via inheritance and the existence of the default
method feature won’t change that.
So the bottom line is, before Java 8, this pattern could only be used with restrictions, and these restrictions still apply with Java 8. If you want to view these restriction as “It’s not possible”, then it is still not possible…