I have classes
abstract class A {
Then i have
interface Maker<T extends A> { SomeClass make(T obj); }
for class maker
class MakerForB implements Maker<B> { } class MakerForC implements Maker<C> { }
and class Factory with one static method
class Factory { public static SomeClass makeSomeClass(A obj) { Maker maker = null; if(obj instanceof B) maker = new MakerForB(); return maker.make(obj); } }
In this case, I get a warning that Maker is a raw type when I declare Maker this way
Maker<?> maker = null;
I get an exception (make is not applicable for arguments A) on
return maker.make(obj);
What is the best way to get rid of these warnings without using
@SuppressWarnings("unchecked")
source share