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

HV-1461 ExecutableHelper#overrides does not work correctly with the method containing generic and non generic parameters #923

Merged
merged 1 commit into from Mar 1, 2018

Conversation

@marko-bekhta
Copy link
Contributor

marko-bekhta commented Feb 28, 2018

As it turned out the upgrade of classmate in da94fc5 from 1.3.1 to 1.3.3 done the trick. So I've just added a test case similar to the one in the JIRA. In case of 1.3.1 version in ExecutableHelper#instanceMethodParametersResolveToSameTypes you would get:

resolvedMethods[0].getArgumentType( i ) = {ResolvedObjectType@1491} "java.lang.Long"
resolvedMethods[1].getArgumentType( i ) = {ResolvedObjectType@1493} "java.lang.Long<org.hibernate.validator.test.internal.util.ExecutableHelperTest$Bar>"

and in case of 1.3.3:

resolvedMethods[0].getArgumentType( i ) = {ResolvedObjectType@1468} "java.lang.Long"
resolvedMethods[1].getArgumentType( i ) = {ResolvedObjectType@1470} "java.lang.Long"

If a backport for the fix is needed and we cannot upgrade the lib version a simple use of .getErasedType() on both sides of argument equals check:

if ( !resolvedMethods[0].getArgumentType( i ).getErasedType().equals( resolvedMethods[1].getArgumentType( i ).getErasedType() ) ) {
	return false;
}

in that same method will do the trick.

- added a case when there's a generic interface method is overridden by a method with
exact non generic type
@marko-bekhta marko-bekhta force-pushed the marko-bekhta:HV-1461 branch from 1423499 to 4ab31ba Feb 28, 2018
@gsmet gsmet merged commit 4ab31ba into hibernate:master Mar 1, 2018
1 check passed
1 check passed
default Build finished.
Details
@gsmet

This comment has been minimized.

Copy link
Member

gsmet commented Mar 1, 2018

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.