> I've never heard of that being banned. It hasn't been banned anywhere i've written Java.
Once code such as the below is rejected in a code review, the next version often submitted is an "if-else-if" ladder using `instanceof` (which is effectively the same thing).
TheReturnType r = null;
try {
DomainType1 instance = (DomainType1)obj;
r = ...
}
catch (ClassCastException ex) {}
if (r == null)
try {
DomainType2 instance = (DomainType2)obj;
r = ...
}
catch (ClassCastException ex) {}
if (r == null)
try {
DomainType3 instance = (DomainType3)obj;
r = ...
}
catch (ClassCastException ex) {}
...
And yes, I have seen the above scenario played out in a professional setting.
Similarly I never been in a company that outright banned c++ language of library features[1]. Turns out that different companies are different.
[1] I guess you would get some push back at review time if you used auto_ptr.
> I've never heard of that being banned. It hasn't been banned anywhere i've written Java.
Once code such as the below is rejected in a code review, the next version often submitted is an "if-else-if" ladder using `instanceof` (which is effectively the same thing).
And yes, I have seen the above scenario played out in a professional setting.