Findbugs は、以下のステートメントで NP_NULL_PARAM_DEREF_NONVIRTUAL をトリガーします
findbugs が registerationdate を非 null パラメータとして認識する理由がわかりません。2 番目のコンストラクターが登録日付の null 値をチェックしていることがわかります。したがって、null deref の可能性はありません。
このバグは誤検知ですか、それとも findbugs にはパラメーターの非 null をチェックする別のメカニズムがありますか?
前もって感謝します、ザーラ
Participant seppl = new Participant( "Mayer", "Seppel", null);
Participant has two constructors:
public Participant() {
surname = "";
forename = "";
registrationDate = new Date();
}
public Participant (String surname, String forename, Date registrationDate) {
setSurname(surname);
setForename(forename);
setRegistrationDate(registrationDate);
}
public void setRegistrationDate (Date registrationDate) {
if (registrationDate != null
&& !registrationDate.equals(this.registrationDate)) {
this.registrationDate = registrationDate;
}
}