You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"public class TestMap extends java.util.HashMap<String,Object> {",
" @NullUnmarked",
" @Override",
" public Object get(Object key) {",
" return super.get(key);",
" }",
" public String getString(String key) {",
" // should be no error here",
" return (String) get(key);",
" }",
"}")
A user may expect that annotating the TestMap.get() method as @NullUnmarked would lead to its return being treated as @NonNull. But, our rules dictate that for unannotated code, inherited library models should apply. So, the inherited library model for Map.get() is applied, and the return becomes @Nullable. Not sure whether we need to fix something here, or whether this is unusual but sensible behavior. My intuition is that an explicit @NullUnmarked annotation should "win" over an inherited library method, but that will just make the rules even more complicated...
The text was updated successfully, but these errors were encountered:
Test case:
NullAway/nullaway/src/test/java/com/uber/nullaway/NullAwayJSpecifyTests.java
Lines 1138 to 1151 in 5d9fbe1
A user may expect that annotating the
TestMap.get()
method as@NullUnmarked
would lead to its return being treated as@NonNull
. But, our rules dictate that for unannotated code, inherited library models should apply. So, the inherited library model forMap.get()
is applied, and the return becomes@Nullable
. Not sure whether we need to fix something here, or whether this is unusual but sensible behavior. My intuition is that an explicit@NullUnmarked
annotation should "win" over an inherited library method, but that will just make the rules even more complicated...The text was updated successfully, but these errors were encountered: