Stewie Stewie - 4 months ago 10x
Java Question

Abstract and concrete method with same signature in generic class

In JLS 8, Section there is a statement:

A concrete method in a generic superclass C can, under certain parameterizations, have
the same signature as an abstract method in that class. In this case, the concrete method
is inherited and the abstract method is not. The inherited
method should then be considered to override its abstract peer from C.

Could anyone provide an example of such parametrization for generic class? I was not able to.



public abstract class A<T> {
    public abstract void m(T t);

    public void m(String s) {}

public class B extends A<String> {

In this case both methods in B will be void m(String).