Given the code below, I get the following compiler error: Type mismatch: cannot convert from Object to String What I don't understand, is why the compiler is unable to resolve T to String in this case (by simply removing <X> (which isn't used), or eg declaring newShape as Shape<Integer> all works fine)
author and iconoclast
Apparently when you drop generics in the declaration, it drops generics completely. Not just the class' generic types but also the method generic types. If you change the declaration in the easiest thing (Shape<?> newShape = ...) it works again.