On 2/12/2015 4:18 PM, Jay Jay Billings
wrote:
Keep in mind that the code example you show is a
strawman argument: that code will fail fast with an
exception at runtime, so it is still checked and nothing
bad will actually happen. It's not like in C where it
will either cause SIGSEGV or run with automatically
casted values that compute invalid results.
True, it does throw a useful runtime exception, but my point is that
using raw types can lead to this kind of bug, when adding in the
types would cause it to not compile in the first place.
I'll have to look at the ListEventListener piece. Casting
to <Object> is worse than not specifying the type if the
generic can be a primitive (<int>, <double>)
because primitives are not Objects. I'm not sure that is the
case here, so it is probably fine. This is the same reason
that I extracted the Identifiable interface from ICEObject
years ago because I needed an Identifiable that was not an
ICEObject. The result was about three hours of unplanned work
to fix casts to ICEObject across the code.
But you can't use a primitive as a type with generics...
I would think you could register a ListEventListener<?>, but
it's registered to both an EventList<T> and an
EventList<String>. For it to not be a raw ListEventListener,
it must be a ListEventListener<? super {T, String}>, which is
not permitted as far as I can tell.
Jordan
_______________________________________________
ice-dev mailing list
ice-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/ice-dev
|