You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
surli
added a commit
to surli/spoon
that referenced
this issue
Jun 21, 2017
surli
changed the title
bug? isSameSignature behavior when extending TypeParameters
bug? isOverriding behavior when extending TypeParameters
Jun 21, 2017
surli
changed the title
bug? isOverriding behavior when extending TypeParameters
issue with isOverriding behavior when extending TypeParameters
Jun 21, 2017
If you consider the interface
Iterable<E>
which contain a methodforEach(Consumer<? super E>)
and if you create a class with aT extends String
which implementsIterable<T>
, then you implement your own version offorEach
: if you useClassTypingContext.isSameSignature()
on the twoforEach
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
ingetAllMethods
(see #1375) we will get bothIterable#forEach
andArrayList#forEach
, when using it onArrayList
.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.The text was updated successfully, but these errors were encountered: