nullness checker problem: map.contains/map.get with static final key from another class

2 views
Skip to first unread message

Piotr Zielinski

unread,
Sep 21, 2009, 12:19:06 PM9/21/09
to Checker Framework discussion
Hi,

The current version of the nullness checker (0.9.9) issues a 'possible
null dereference' warning in

if (someMap.contains(AnotherClass.FINAL_STATIC_STRING_FIELD)) {
someMap.get(AnotherClass.FINAL_STATIC_STRING_FIELD).toString();
}

however, the following works ok

String key = AnotherClass.FINAL_STATIC_STRING_FIELD;
if (someMap.contains(key)) {
someMap.get(key).toString();
}

Could you fix this?

Thanks,
Piotr
Reply all
Reply to author
Forward
0 new messages