Java tuning tutorial 3 - Tuning NPE.RET to reduce false positives
Let's say we have a snippet:
package com.klocwork.jdefects.checkers.dfa.binding_walkthrough; public class CheckSample1 { public String toString() { final Object o = get(); return o.toString(); } private Object get() { if (hashCode() > 0 ) { return new Object(); } return null; } }
An analysis with kwcheck detects the NPE.RET issue, where null comes from the get()and is dereferenced at o.toString().