Let's assume we have an interface "I" and n implementations of "I" named "C1" to "Cn". Let's assume further the interface as well as the implementations reside in an external library which cannot be changed. Finally, let's assume we are using Java 8.  

Now we want to extend the functionality of all implementations of "I".  

If "I" were changeable, we could simply add new methods with default implementations to it, as Oracle did to roll out the streaming API. Unfortunately "I" is not changeable.  

My current solution is as follows:  

Create a new interface "IX" which extends "I" and contains the required new methods as default implementations to it.  

Because "C1" to "Cn" do not implement "IX" but "I", we need Implementations "CX1" to "CXn" to make use of the new functionality. This is the part I do not like. I'd prefer a way to create the implementation on the fly like anonymous classes.  

Here are some code examples to illustrate my approach:  

```
// Instantiate existing "C9" implementation of "I"
I object = new C9();

// Definition of interface "IX"
public interface IX extends I {
  default void newMethod() {
    // Do something
  }
}

// Example definition of implementation "CX9"
// Off course, this needs to be done for all "C1" to "Cn".
public class CX9 extends C9 implements IX {}

// Instantiate extended implementation "C9"
IX object = new CX9();

```

Because the definitions of "CX1" to "CXn" do not need any body implementation at all, I consider those boilerplate and would like to get rid of them. I actually would prefer something like the following.

```
IX object = new (C9 implements IX)() {};

```

That, off course, is no valid Java code. The idea is to create an anonymous class which is based on an existing class ("C9") implementing an additional interface ("IX"). Is there a way to do this with standard Java?  

I definitely want to do this with standard Java and without byte code manipulation. Off course, I could use wrappers or dynamic proxies but "I" and the "C"s define lots of methods. Therefore I would end up with even more boilerplate code.  

I admit this question is purely academic, because in the end it's about getting rid of only one line of code per implementation of "I". But I'm still interested in the possible solutions.  

If you like a more practical approach, assume you want to impose something like the streaming API on an unknown set of implementations without having the ability to change the underlying interface.  

Thanks for your opinion on this.