junit-team / junit5

✅ The 5th major version of the programmer-friendly testing framework for Java and the JVM
https://junit.org
Eclipse Public License 2.0
6.44k stars 1.5k forks source link

Change return type to `Stream<? extends TestTemplateInvocationContext>` #3577

Open sormuras opened 1 year ago

sormuras commented 1 year ago

https://github.com/junit-team/junit5/blob/f5b78f68c6a90dfa63611c7a10027581c5d913ba/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java#L87

Michael wrote:

I mean I tried to do Stream.generate(() -> new MyInvocationContext()).limit(/*number*/) This does not work. but Stream.generate(() -> new MyInvocationContext()).limit(/*number*/).map(e -> e) works...

sormuras commented 1 year ago

Question is, can we change the return type without breaking existing code?

marcphilipp commented 1 year ago

According to https://wiki.eclipse.org/Evolving_Java-based_APIs_2#Evolving_API_interfaces_-_API_methods that would break binary compatibility. We should have declared the method like that initially, though.