specification for null handling in String, StringBuilder, etc. (original) (raw)
David Schlosnagle schlosna at gmail.com
Tue Jun 12 14:56:27 UTC 2012
- Previous message: specification for null handling in String, StringBuilder, etc.
- Next message: specification for null handling in String, StringBuilder, etc.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Jun 12, 2012 at 9:04 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
On 12/06/2012 06:40, David Holmes wrote:
This is very, very common in the core libraries. Rather than document every single method where a null parameter triggers NPE they are often covered (directly or indirectly) by blanket statements of the form "unless otherwise stated ...". Right, @throws NullPointerException can be considered clutter so it's common to see a blanket statement in the class or package description. In the case of String it already has: *
Unless otherwise noted, passing a null argument to a
constructor * or method in this class will cause a {@link NullPointerException} to be * thrown. This was added via 4703640 a long time ago. Clearly a blanket statement like this doesn't make sense in all cases as there will be APIs that define many methods that allow null. -Alan
Sounds like a job for JSR-305 annotations if/when those are ever approved.
Thanks, Dave
- Previous message: specification for null handling in String, StringBuilder, etc.
- Next message: specification for null handling in String, StringBuilder, etc.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]