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

Consider calling state.Action#precondition, state.Action#transformer without reflection #331

Closed
vlsi opened this issue May 16, 2022 · 5 comments
Labels

Comments

@vlsi
Copy link
Contributor

vlsi commented May 16, 2022

Testing Problem

I'm trying the new API from #134, and I see jqwik calls state.Action methods via reflection.
It makes it harder to understand the stacktrace.

Suggested Solution

Call interface methods without reflection.

Discussion

Is reflection needed there?
I do understand the reflection might help the engine to verify if the class has a non-trivial method implementation, however, I believe calling the method via reflection is both easier to understand, faster, and less prone to errors.

@vlsi
Copy link
Contributor Author

vlsi commented May 16, 2022

PS. I'm not sure this is an issue, and it looks like GitHub Discussions might be better for these types of "issues".

@jlink
Copy link
Collaborator

jlink commented Jun 3, 2022

Why does the reflective call bother you? It's not called so often that a performance problem is likely.

Reflection is currently necessary to determine if the methods at hand are overridden. The subsequent call of the overridden method could, I assume, be done statically.

@vlsi
Copy link
Contributor Author

vlsi commented Jun 3, 2022

Why does the reflective call bother you? It's not called so often that a performance problem is likely.

Stacktraces become harder to understand.
"find usages" does not show reflective usages.
The code is harder to follow.

The subsequent call of the overridden method could, I assume, be done statically.

That is exactly my suggestion.

@jlink jlink added the cleanup label Jun 3, 2022
@jlink
Copy link
Collaborator

jlink commented Jun 3, 2022

Stacktraces become harder to understand.
"find usages" does not show reflective usages.

Reasonable argument.

Since Action will probably be refactored into two separate interfaces, I'll defer until this is done.

@jlink
Copy link
Collaborator

jlink commented Jul 19, 2022

Has been resolved with the introduction of Action.Dependent and Action.Independent in 85f5f03

@jlink jlink closed this as completed Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants