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
move method reflection from ExtensionFactoryDelegate to ExtensionMetadata #2414
Conversation
Turns out that there is actually a lot of stupidity in the original code. An interface can not override any method from Object (because ... rules). So all of the tests can go away, because we only create the metadata for interfaces. |
df368f3
to
d7817e0
Compare
4083ce4
to
d93920a
Compare
@@ -44,6 +45,15 @@ public interface ExtensionHandler { | |||
/** Handler that only returns null independent of any input parameters. */ | |||
ExtensionHandler NULL_HANDLER = (handleSupplier, target, args) -> null; | |||
|
|||
/** Constant for {@link Object#equals(Object)}. */ | |||
Method EQUALS_METHOD = JdbiClassUtils.methodLookup(Object.class, "equals", Object.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally had these in JdbiClassUtils
in order to have them not be part of the public API. Do we really want to ship this as part of public API?
* Returns a reference to a method that overrides {@link Object#finalize()} if it exists. | ||
* @return An {@link Optional} containing a {@link Method} if a finalizer exists. | ||
*/ | ||
public Optional<Method> getFinalizer() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally had this as package-private so it is not part of the public API.
Do we really think this should be a fully supported part of the public API?
Interfaces can not override any method from Object and the extension metadata is only created for interfaces. So there is no need to do any checking. Rip out all of the check logic, add constant methods (except for toString). Cache the finalizer if present in extension metadata.
d93920a
to
3e802fe
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
fixes #2413