[refactor] moving check_attributes to patternMatch.ml

Reviewed By: jeremydubreil

Differential Revision: D3994790

fbshipit-source-id: 7d12e52
master
Peter O'Hearn 8 years ago committed by Facebook Github Bot
parent 95a82a6a04
commit 6b2a9de863

@ -155,7 +155,7 @@ let process_results_table tab = (
let should_analyze_file file_env =
IList.exists
(fun (_, tenv, pname, _) ->
AnnotationReachability.check_attributes Annotations.ia_is_thread_safe tenv pname
PatternMatch.check_class_attributes Annotations.ia_is_thread_safe tenv pname
)
file_env

@ -134,13 +134,6 @@ let is_allocator tenv pname =
false
let check_attributes check tenv pname =
let check_class_attributes check tenv = function
| Procname.Java java_pname ->
let check_class_annots _ { StructTyp.annots; } = check annots in
PatternMatch.supertype_exists tenv
check_class_annots
(Procname.java_get_class_type_name java_pname)
| _ -> false in
let check_method_attributes check pname =
match Specs.proc_resolve_attributes pname with
| None -> false
@ -148,7 +141,7 @@ let check_attributes check tenv pname =
let annotated_signature = Annotations.get_annotated_signature attributes in
let ret_annotation, _ = annotated_signature.Annotations.ret in
check ret_annotation in
check_class_attributes check tenv pname || check_method_attributes check pname
PatternMatch.check_class_attributes check tenv pname || check_method_attributes check pname
let method_overrides is_annotated tenv pname =
let overrides () =

@ -370,3 +370,12 @@ let is_exception tenv typename =
(** Checks if the class name is a Java exception *)
let is_throwable tenv typename =
is_subtype_of_str tenv typename "java.lang.Throwable"
(** tests whether any class attributes (e.g., @ThreadSafe) pass check of first argument*)
let check_class_attributes check tenv = function
| Procname.Java java_pname ->
let check_class_annots _ { StructTyp.annots; } = check annots in
supertype_exists tenv
check_class_annots
(Procname.java_get_class_type_name java_pname)
| _ -> false

@ -110,3 +110,6 @@ val is_throwable : Tenv.t -> Typename.t -> bool
(** [is_runtime_exception tenv class_name] checks if classname is
of type java.lang.RuntimeException *)
val is_runtime_exception : Tenv.t -> Typename.t -> bool
(** tests whether any class attributes (e.g., @ThreadSafe) pass check of first argument*)
val check_class_attributes : (Annot.Item.t -> bool) -> Tenv.t -> Procname.t -> bool

Loading…
Cancel
Save