-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
6-pool
-
generic
-
generic
http://download.oracle.com/javase/tutorial/java/IandI/usinginterface.html
The example given in section 'Implementing the Relatable Interface' doesn't suggest a good design and might confuse beginner programmers, in my opinion:
As RectanglePlus implements the Relatable interface, I would expect that I can pass any kind of Relatable instances in the isLargerThan method, however, I would encounter an ugly big exception if I tried it with objects other than RectanglePlus (or its subclasses).
Hard coding exact types in an interface implementation questions the whole point of using an interface.
The example given in section 'Implementing the Relatable Interface' doesn't suggest a good design and might confuse beginner programmers, in my opinion:
As RectanglePlus implements the Relatable interface, I would expect that I can pass any kind of Relatable instances in the isLargerThan method, however, I would encounter an ugly big exception if I tried it with objects other than RectanglePlus (or its subclasses).
Hard coding exact types in an interface implementation questions the whole point of using an interface.