I do like you do. But I can see why some fall back to the raw type as
it's less "annoying" when developing.
On Thu 2014-08-07 17:26, Gunnar Morling wrote:
Hi,
every now and then I run into usages of raw types in our code bases:
* Class entityType (instead of Class<?>)
* Set querySpaces (instead of Set<String>)
...
I first thought that'd be left-overs from ancient times but apparently this
is also done in newly written code. I don't like it as in some cases it's
clearly a loss of information which requires investigation in surrounding
code to find out e.g. which types are put into a raw Set. In other cases
(e.g. Class) I prefer to use the wildcard type (Class<?>) as it avoids many
raw-type warnings in the IDE (which otherwise may obfuscate legitimate
warnings).
Is there any reason for using raw types in new code rather than full
generic or wildcard types?
Personally I try to fix existing usages of raw types and avoid to add new
ones if possible, but sometimes I can't (e.g. one cannot override a method
expecting a Class with a method expecting a Class<?>).
Thanks,
--Gunnar
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev