[JBoss JIRA] (ROASTER-121) Overridden interface has wrong signature
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/ROASTER-121?page=com.atlassian.jira.plugi... ]
George Gastaldi updated ROASTER-121:
------------------------------------
Description:
When you implement an interface that extends another interface that has generic parameters, these parameters are not taken into account, when generating the signature of the overridden method. Will explain more in the steps to reproduce.
Having:
{code:java}
abstract class A {
public interface Iface1<T extends A> {
void doSomething(T smth);
}
}
public classs C {
public interface Iface2 extends A.Iface1<C.D> {
}
public class D extends A{
}
}
{code}
Now when we implement C.Iface2 we should get the method with signature:
_public void doSomething(C.D smth)_,
as C.D is specified for the generic type, but instead we get:
_public void doSomething(A smth)_
which is wrong because class A is abstract for one, and type erasure was not done right because otherwise the method signature would have the right type of parameters.
was:
When you implement an interface that extends another interface that has generic parameters, these parameters are not taken into account, when generating the signature of the overridden method. Will explain more in the steps to reproduce.
Having:
abstract class A {
public interface Iface1<T extends A> {
void doSomething(T smth);
}
}
public classs C {
public interface Iface2 extends A.Iface1<C.D> {
}
public class D extends A{
}
}
Now when we implement C.Iface2 we should get the method with signature:
_public void doSomething(C.D smth)_,
as C.D is specified for the generic type, but instead we get:
_public void doSomething(A smth)_
which is wrong because class A is abstract for one, and type erasure was not done right because otherwise the method signature would have the right type of parameters.
> Overridden interface has wrong signature
> ----------------------------------------
>
> Key: ROASTER-121
> URL: https://issues.jboss.org/browse/ROASTER-121
> Project: Roaster
> Issue Type: Bug
> Components: JDT
> Affects Versions: 2.19.4.Final
> Reporter: plamen petkov
>
> When you implement an interface that extends another interface that has generic parameters, these parameters are not taken into account, when generating the signature of the overridden method. Will explain more in the steps to reproduce.
> Having:
> {code:java}
> abstract class A {
> public interface Iface1<T extends A> {
> void doSomething(T smth);
> }
> }
> public classs C {
> public interface Iface2 extends A.Iface1<C.D> {
> }
> public class D extends A{
> }
> }
> {code}
> Now when we implement C.Iface2 we should get the method with signature:
> _public void doSomething(C.D smth)_,
> as C.D is specified for the generic type, but instead we get:
> _public void doSomething(A smth)_
> which is wrong because class A is abstract for one, and type erasure was not done right because otherwise the method signature would have the right type of parameters.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)