Non-null analysis in Java
Alex Rønne Petersen
xtzgzorex at gmail.com
Sun Dec 11 05:19:53 PST 2011
On 11-12-2011 14:18, deadalnix wrote:
> Le 11/12/2011 11:29, Somedude a écrit :
>> Just for the record, non-null static and runtime analysis is implemented
>> in a number of Java projects.
>> Anotation based Static analysis for eclipse
>> * javax.validation.constraints.NotNull
>> Created for runtime validation, not static analysis.
>> * edu.umd.cs.findbugs.annotations.NonNull
>> Static analysis
>> * com.intellij.annotations.NotNull
>> Used by IntelliJ IDEA IDE for static analysis.
>> * lombok.NonNull
>> Annotation used to control code generation in Project Lombok.
> We definitively should have a non nullable type in D. Null check are:
> - Easy to forget, leading to catastrophic results when forgotten.
> - Crippling the codebase at an alarming speed if you want reliable code.
> Plus, when an error occurs with null, it is usually hard to track and
> solve, because you have to understand how that b****y variable ends up
> being null.
> Arguably, things should be non nullable by default.
> Tony Hoare (inventor of null ?) recently gave this conference :
I think the idea with D's @disable attribute on default struct
contructors is to allow implementing a NoNull type. Still, I'd prefer
having it in the language.
More information about the Digitalmars-d