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.
http://eclipseandjazz.blogspot.com/2011/12/inter-procedural-null-analysis-using.html
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 :
http://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare