HРР-8573: Test case and fix

Comment in EntityType.java has been removed, because I think that the patch does what the commentator had in mind. A test case illustrates just one of the possible situations although there may be other similar ones.
I think these changes should be merged also in the 4.2 branch to get quickly to users.