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

issue with isOverriding behavior when extending TypeParameters #1407

Closed
surli opened this issue Jun 21, 2017 · 1 comment
Closed

issue with isOverriding behavior when extending TypeParameters #1407

surli opened this issue Jun 21, 2017 · 1 comment
Labels

Comments

@surli
Copy link
Collaborator

surli commented Jun 21, 2017

If you consider the interface Iterable<E> which contain a method forEach(Consumer<? super E>) and if you create a class with a T extends String which implements Iterable<T>, then you implement your own version of forEach: if you use ClassTypingContext.isSameSignature() on the two forEach methods, it will return false because they do not have the same type parameter.

I'm really not sure if this is a bug or not: in the overriding method, the type parameter is more defined, so the signature is not exactly the same. But then, if we only use isSameSignature in getAllMethods (see #1375) we will get both Iterable#forEach and ArrayList#forEach, when using it on ArrayList.

WDYT? Should we consider the signature are the same, or should we consider that getAllMethods should indeed return the two different methods?

Edit: Actually I extended my test to check with isOverriding and it returns false which is obviously wrong. So there's a real issue here.

surli added a commit to surli/spoon that referenced this issue Jun 21, 2017
@surli surli changed the title bug? isSameSignature behavior when extending TypeParameters bug? isOverriding behavior when extending TypeParameters Jun 21, 2017
@surli surli changed the title bug? isOverriding behavior when extending TypeParameters issue with isOverriding behavior when extending TypeParameters Jun 21, 2017
@surli surli added the bug label Jun 21, 2017
@pvojtechovsky
Copy link
Collaborator

pvojtechovsky commented Jun 21, 2017

Should we consider the signature are the same

yes, there must be reported as same in this case. It is bug, which will be fixed in #1411

surli added a commit to pvojtechovsky/spoon that referenced this issue Jun 26, 2017
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