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

Replace reflection with method handles #14009

Closed
normanmaurer opened this issue Apr 27, 2024 · 1 comment · Fixed by #14032
Closed

Replace reflection with method handles #14009

normanmaurer opened this issue Apr 27, 2024 · 1 comment · Fixed by #14032
Assignees
Milestone

Comments

@normanmaurer
Copy link
Member

We now use java8 in the 4.2 branch so we should replace our reflection usage with method handles.

@normanmaurer normanmaurer added this to the 4.2.0.Final milestone Apr 27, 2024
@normanmaurer
Copy link
Member Author

/cc @chrisvest

@chrisvest chrisvest self-assigned this May 3, 2024
@chrisvest chrisvest linked a pull request May 3, 2024 that will close this issue
normanmaurer pushed a commit that referenced this issue May 7, 2024
Motivation:
We've been using reflection as a way to abstract over Java API versions.
Now that we're based on Java 8, some of this reflection usage is no
longer necessary. In some cases, the APIs we were reflecting on are now
directly available. In other cases, we'd like a little more performance
and can call through method handles instead.

Modification:
Remove some reflection usage that was necessary when running on Java 6
or 7, and replace it with direct calls if the code is still needed.
Replace the more performance sensitive reflection usage with
MethodHandles.

Also remove the animal sniffer maven plug-in, because animal sniffer
does not support signature polymorphic method calls.
See mojohaus/animal-sniffer#67

Result:
Cleaner, and perhaps slightly faster, code.

Fixes #14009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants