If I have an interface with a common method, for example:
public interface Thing {
void <T extends Comparable<? super T>> doSomething(List<T> objects);
}
I need this ugly generic typespec in some places, but it really doesn't need most implementations:
public class ICareAboutSortingThing implements Thing {
@Override
public void <T extends Comparable<? super T>> doSomething(List<T> objects) { ... }
}
public class IDontCareAboutSortingThingx100 implements Thing {
@Override
public void <T extends Comparable<? super T>> doSomething(List<T> objects) { ... }
}
What I would like to write is something like:
public class IDontCareAboutSortingThingx100 implements Thing {
@Override
public void <?> doSomething(List<?> objects) { ... }
}
This should be completely typical, as I understand it, but are there any changes to these kinds of reductions that will work? I understand that the compiler does not allow overriding non-generic methods, but this is a case of replacing type arguments with wildcards. I guess this is not actually supported, because the compiler can just as easily support
public class IDontCareAboutSortingThingx100 implements Thing {
@Override
public void <T> doSomething(List<T> objects) { ... }
}
. , , , . , , - .