To understand this, you must ask yourself: "Can I fine tune BaseModel for any use of the Model interface?
When you specialize in return value, this works just fine. Even if getModel() returns a BaseModel , it can always be assigned to the Model variable.
Model model = myModel.getModel();
Otherwise, this is not true:
SomeOtherModel other = ...; myModel.setModel(other); // no problem myBaseModel.setModel(other); // other is not a BaseModel!
if setModel was to accept the BaseModel parameter, you would break its ability to be set with other implementations of the Model . Therefore, this is not permitted.
source share