Stephen Kestle <[EMAIL PROTECTED]> wrote on 03/12/2007 07:05:21 PM:
> I'm unsure why people who use Java 5 only should pay a runtime penalty > when it isn't needed. If this issue concerns you, use > java.utils.Collection.CheckedCollection. Being a C fanatic, I said the same thing about array bounds checking and garbage collection. In for a penny in for a pound. But at least in C I _knew_ I was responsible for ... well... everything. This may be an example of my point about illusory safety. You write all your own code from scratch? Or you use only libraries which have been generified? You never pass a Java5 collection to a library written before generics? To give an example close to home: you _never_ use the current commons-collections, in particular the "TransformedCollection" decorator? Just because your code is Java5 and you're only using the java5 jvm doesn't mean that everything maven goes out to grab was compiled with java 5 as a target. Transitive dependencies aggravate this situation. If you're writing something that is supposed to work with 1.5 _and_ 1.4, you cannot use CheckedCollection. Kindof a gotcha. Are you going to still produce binary releases which are compatible with 1.4, even though they won't be able to compile the new source releases? Or are you going to use some sort of code stripper thingy which gets rid of generics for backwards source compatibility? Bear in mind that SDKs <=1.4 inspired this library due to perceived shortcomings in the reference implementations of the collection framework interfaces. It seems counterintuitive to make SDKs >= 1.5 the only platform on which this can compile. But as long as the binaries stay backwards-compatible, that's OK. > However, if the "library offers real type safety" already, then it > should continue to do so, or at least offer a decent workaround. Amen! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]