Re:Google open sources "Contracts for Java"
by ShabbyDoo on Saturday February 05, 2011 @01:48PM
(#2183680)
For completeness, PMD should be added to the list although I haven't found it as useful as FindBugs:
Re:Google open sources "Contracts for Java"
by tikkes on Saturday February 05, 2011 @07:17AM
(#2182949)
Eclipse does not do static analysis by default I believe. There are some patches however...
Re:Google open sources "Contracts for Java"
by ShabbyDoo on Saturday February 05, 2011 @01:46PM
(#2183669)
The out-of-the-box Eclipse distro does include some static analysis stuff, but it's turned off by default. Preferences->Java->Compiler->Errors/Warnings. Under "Potential Programming Problems", you can alert on such things as guaranteed NPEs, etc.
While I'm not sure if we may count those as "programmation by contract", some Java tools provide (some) static analysis:
- Findbugs
- IntelliJ IDEA does some nullness analysis : http://www.jetbrains.com/idea/documentation/howto.html
- JSR 305 (Annotations for Software Defect Detection in Java) attempted to standardize on a set of annotations. We use it in our project, mainly the @Nonnull at the moment... I believe Findbugs considers these annotations.
- CodePro Analytix, also recently open sourced by Google, might also do some static analysis: http://code.google.com/javadevtools/codepro/doc/index.html
- Eclipse might too (any expert Eclipse user knows?)
I think there is still a lot to do in this space. "Contracts for Java" is a step in the right direction :)