June 30, 2003

Jakarta Commons

ONJava.com has an interesting article about Jakarta Commons . Lots of stuff which extends and complements the Java standard libraries. Net looks cool, and I may have an immeadiate use for CLI.

Looking at the description for Lang reminds me of an Objective-C feature that I really miss in Java: categories. A category allows you to add methods to any class, even if you don't have the source code for the class. The lack of this feature in Java means you have to use utility classes with static methods to provide additional operations for classes like java.lang.String, which is much less elegant than simply adding methods to java.lang.String.

(Although, even if Java had categories, it still might not be possible to add methods to java.lang.String since it is declared final. String is supposedly final for "security reasons", but I'm not sure if I buy that.)

Posted by Dirtae at June 30, 2003 06:21 PM
Comments

Declaring the String final makes it immutable, so that it can't be subclassed with some malicious behavior added. My guess is that String's such a commonly-used class in Java that they had to make some assurances that it couldn't be compromised in a subclass.

Posted by: Erik at June 30, 2003 08:14 PM
Post a comment









Remember personal info?