Skip to content

Commit

Permalink
[infer][java] Adding the android.jar in the classpath is not needed a…
Browse files Browse the repository at this point in the history
…nymore

Summary:
This is legacy code that dates back from when we needed the fields in the models to match exactly the fields in the classes being modeled. We no longer need to this. Besides, it seems that this `android.jar` stopped being part of the release for a while. So this change will not affect the results in prod

I check in details the difference on the code of Guava and it seems to remove (weird) false positives only.

Reviewed By: sblackshear

Differential Revision: D4242444

fbshipit-source-id: 84dd782
  • Loading branch information
jeremydubreil authored and Facebook Github Bot committed Dec 7, 2016
1 parent e212183 commit d89c69d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
4 changes: 0 additions & 4 deletions infer/src/harness/androidFramework.ml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,3 @@ let get_lifecycle_for_framework_typ_opt tenv lifecycle_typ lifecycle_proc_strs =

(** return the complete list of (package, lifecycle_classname, lifecycle_methods) trios *)
let get_lifecycles = android_lifecycles

let non_stub_android_jar () =
let root_dir = Filename.dirname (Filename.dirname Sys.executable_name) in
IList.fold_left Filename.concat root_dir ["lib"; "java"; "android"; "android-19.jar"]
3 changes: 0 additions & 3 deletions infer/src/harness/androidFramework.mli
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,3 @@ val get_lifecycle_for_framework_typ_opt : Tenv.t -> Typename.t -> string list ->

(** return true if [class_name] is the name of a class that belong to the Android framework *)
val is_android_lib_class : Typename.t -> bool

(** Path to the android.jar file containing real code, not just the method stubs as in the SDK *)
val non_stub_android_jar : unit -> string
7 changes: 1 addition & 6 deletions infer/src/java/jClasspath.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ let is_model procname =
let split_classpath cp = Str.split (Str.regexp JFile.sep) cp


(** Add the android.jar containing bytecode at the beginning of the class path *)
let add_android_jar paths =
AndroidFramework.non_stub_android_jar () :: paths


let append_path classpath path =
if Sys.file_exists path then
let full_path = filename_to_absolute path in
Expand Down Expand Up @@ -188,7 +183,7 @@ let load_from_verbose_output () =
IList.fold_left
append_path
""
((StringSet.elements roots) @ (add_android_jar paths)) in
((StringSet.elements roots) @ paths) in
(classpath, sources, classes) in
loop [] StringSet.empty StringMap.empty JBasics.ClassSet.empty

Expand Down

0 comments on commit d89c69d

Please sign in to comment.