From e3de7ce5dc72924055cd9c47761979abc0c88b79 Mon Sep 17 00:00:00 2001 From: Mitya Lyubarskiy Date: Wed, 21 Oct 2020 02:17:56 -0700 Subject: [PATCH] [nullsafe] Unsoundly consider Pair<> elements non-nullable Reviewed By: artempyanykh Differential Revision: D24418550 fbshipit-source-id: 9d6cdb3d3 --- infer/src/nullsafe/modelTables.ml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/infer/src/nullsafe/modelTables.ml b/infer/src/nullsafe/modelTables.ml index 298134b00..514991f5e 100644 --- a/infer/src/nullsafe/modelTables.ml +++ b/infer/src/nullsafe/modelTables.ml @@ -776,6 +776,17 @@ let field_nullability = ; ("android.os.Build.SUPPORTED_ABIS", o) ; ( "android.os.Message.obj" , n (* An extra object going with the message - null if was not attached *) ) + ; ( "android.util.Pair.first" + , o + (* Deliberate UNSOUNDNESS. Since we don't support annotations in generic params, + for the sake of usability we consider Pair to be non-nullable, + which is true in majority of usages. + This is a concious decision: Pair is a useful utility class, and without this + it would be barely usable in practice. + This is also on par with our policy for arrays and other containers, which are considered + non-nullable. + *) ) + ; ("android.util.Pair.second", o) ; ("android.util.Patterns.DOMAIN_NAME", o) ; ("android.util.Patterns.EMAIL_ADDRESS", o) ; ("android.util.Patterns.IP_ADDRESS", o)