lundi 22 mai 2017

Why does Java claim there's 2 declared methods when bounded generics are involved?

With the following definitions:

public interface BaseService<T, ID> {

    T findOne(@GraphQLArgument(name = "id") ID id);

}

public class BaseServiceImpl<T,ID extends Serializable> implements BaseService<T, ID> {

    @Override
    public T findOne(@GraphQLArgument(name = "id") ID id) {
        return null;
    }

}

Why does BaseServiceImpl.class.getDeclaredMethods() return 2 methods:

  • public java.lang.Object BaseServiceImpl.findOne(java.io.Serializable)
  • public java.lang.Object BaseServiceImpl.findOne(java.lang.Object)

Is there a way to filter these out?





Aucun commentaire:

Enregistrer un commentaire