diff --git a/TODO.md b/TODO.md index ccaf47f2c..77ca247e2 100644 --- a/TODO.md +++ b/TODO.md @@ -1,8 +1,5 @@ # 1.9.2 - - Bug with provider method type matching in interface default methods. - See https://github.com/jqwik-team/jqwik/issues/599. - # 1.9.x - Summon preconfigured arbitrary. See https://github.com/jqwik-team/jqwik/issues/527 diff --git a/documentation/src/docs/include/customized-parameter-generation.md b/documentation/src/docs/include/customized-parameter-generation.md index cf076b4e8..f4399f3fa 100644 --- a/documentation/src/docs/include/customized-parameter-generation.md +++ b/documentation/src/docs/include/customized-parameter-generation.md @@ -42,10 +42,8 @@ If the return type cannot be matched, jqwik will throw a `CannotFindArbitraryExc **Caveat:** -Up to version `1.7.4`, it was possible that the provider method's return type -was broader than the property method's parameter type. -Since version `1.8.0` this is no longer the case. -That's why the following code _will now fail at runtime_ with a `CannotFindArbitraryException`: +Between versions `1.8.0` and `1.9.1`, matching the provider method's return type to the parameter type was very strict. +That's why the following code _would fail at runtime_ with a `CannotFindArbitraryException`: ```java @Property @@ -58,6 +56,15 @@ Arbitrary favouritePrimes() { } ``` +Starting with version `1.9.2` return type matching is very loose again. +The only enforced constraint is that the return type must be a subtype of `Arbitrary`. +Therefore the above code will work again. + +_The downside:_ If the arbitrary provided by the method will create an object of the wrong type, +there will be an `IllegalArgumentException` thrown when jqwik tries to execute the property method. +This is a trade-off between strict type checking and convenience. + + #### How to write a provider method Arbitrary provision often starts with a