@ -16,63 +16,50 @@ module Hashtbl = Caml.Hashtbl
(* in strict mode, give an error if a nullable is passed to checkNotNull *)
let check_not_null_strict = false
(* o is not annotated and n is annotated with @Nullable *)
(* the type should be treated as Nonnull *)
let o = false
(* the type should be treated as Nullable *)
and n = true
(* create unannotated signature with n argument *)
let unannotated n =
let rec loop l = function i when i < = 0 -> ( o , l ) | i -> loop ( o :: l ) ( i - 1 ) in
loop [] n
(* create signature where both return type and params are nonnull *)
let all_nonnull num_params = ( o , List . init num_params ~ f : ( fun _ -> o ) )
(* o<N> means signature with N nonnull params and nonnull return type *)
(* not annotated with one unannotated argument *)
let o1 = unannotated 1
let o1 = all_nonnull 1
(* not annotated with two unannotated arguments *)
let o2 = unannotated 2
let o2 = all_nonnull 2
(* not annotated with three unannotated arguments *)
let o3 = unannotated 3
let o3 = all_nonnull 3
(* not annotated with four unannotated arguments *)
let o4 = unannotated 4
let o4 = all_nonnull 4
(* not annotated with five unannotated arguments *)
let o5 = unannotated 5
let o5 = all_nonnull 5
(* not annotated with six unannotated arguments *)
let o6 = unannotated 6
let o6 = all_nonnull 6
(* not annotated with seven unannotated arguments *)
let o7 = unannotated 7
let o7 = all_nonnull 7
(* not annotated with eight unannotated arguments *)
let o8 = unannotated 8
let o8 = all_nonnull 8
(* not annotated with nine unannotated arguments *)
let o9 = unannotated 9
let o9 = all_nonnull 9
(* not annotated with ten unannotated arguments *)
let o10 = unannotated 10
let o10 = all_nonnull 10
(* not annotated with eleven unannotated arguments *)
let o11 = unannotated 11
let o11 = all_nonnull 11
(* not annotated with twelve unannotated arguments *)
let o12 = unannotated 12
let o12 = all_nonnull 12
(* n<N> stands for signature with nonnull return type and N nullable params *)
(* one argument nullable *)
let n1 = ( o , [ n ] )
(* two arguments nullable *)
let n2 = ( o , [ n ; n ] )
(* three arguments nullable *)
let n3 = ( o , [ n ; n ; n ] )
(* the second argument is nullable *)
(* the second argument is nullable , everything else is nonnull *)
let on = ( o , [ o ; n ] )
(* container add *)
@ -202,8 +189,8 @@ let mapPut_list =
; ( cp , " java.util.Map.put(java.lang.Object,java.lang.Object):java.lang.Object " ) ]
(* * Models for @Nullable annotations *)
let annotated_list_nullab le =
(* * Models for nullability *)
let annotated_list_nullab ility =
check_not_null_list @ check_state_list @ check_argument_list
@ [ ( o1
, " android.text.SpannableString.valueOf(java.lang.CharSequence):android.text.SpannableString "
@ -584,7 +571,7 @@ let mk_table list =
let this_file = Filename . basename _ _ FILE__
let annotated_table_nullab le = mk_table annotated_list_nullable
let annotated_table_nullab ility = mk_table annotated_list_nullability
let check_not_null_table , check_not_null_parameter_table =
( mk_table check_not_null_list , mk_table check_not_null_parameter_list )