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

Viewed 139

With the following definitions:

public interface BaseService<T, ID> {

    T findOne(ID id);

}

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

    @Override
    public T findOne(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?

1 Answers
Related