Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fallbackGenerators are actually called from real calls #588

Open
yanok opened this issue Nov 18, 2022 · 2 comments
Open

fallbackGenerators are actually called from real calls #588

yanok opened this issue Nov 18, 2022 · 2 comments
Labels
P3 A lower priority bug or feature request type-documentation A request to add or improve documentation

Comments

@yanok
Copy link
Contributor

yanok commented Nov 18, 2022

The documentation for fallbackGenerators says:

The fallback values will never be returned from a real member call; these are not stub return values. They are only used internally by mockito as valid return values.

... but the actual generated code has

returnValueForMissingStub: _i10.getShim<T>(flag)

(where getShim is my fallback generator), so it does actually call fallback generator if the stub is missing and returns values to the caller. I've seen people even relying on this ;(

So, should we fix the doc or the behavior?

@srawlins
Copy link
Member

I believe @emmanuel-p added this in 5d23067 (I approved). If I remember, the justification at the time was that this helped move null safety migrations along (maybe specifically in sound mode).

I don't have a strong opinion on fixing the docs or changing the behavior.

@yanok
Copy link
Contributor Author

yanok commented May 25, 2023

Right, G3 relies on this now, I guess we have to fix the docs.

@yanok yanok added P3 A lower priority bug or feature request Type: documentation labels Jun 1, 2023
@devoncarew devoncarew added type-documentation A request to add or improve documentation and removed Type: documentation labels Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 A lower priority bug or feature request type-documentation A request to add or improve documentation
Projects
None yet
Development

No branches or pull requests

3 participants