diff --git a/infer/src/harness/androidFramework.ml b/infer/src/harness/androidFramework.ml index 9ca6fb22d..ad3e9a57b 100644 --- a/infer/src/harness/androidFramework.ml +++ b/infer/src/harness/androidFramework.ml @@ -278,7 +278,7 @@ let get_all_supertypes typ tenv = and get_supers_rec typ tenv all_supers = let direct_supers = get_direct_supers typ in IList.fold_left (fun typs (_, name) -> add_typ name typs) all_supers direct_supers in - get_supers_rec typ tenv TypSet.empty + get_supers_rec typ tenv (TypSet.add typ TypSet.empty) (** return true if [typ0] <: [typ1] *) let is_subtype (typ0 : Sil.typ) (typ1 : Sil.typ) tenv = diff --git a/infer/tests/ant_report.json b/infer/tests/ant_report.json index ba0df7c3e..d2e566b96 100644 --- a/infer/tests/ant_report.json +++ b/infer/tests/ant_report.json @@ -9,6 +9,11 @@ "file": "codetoanalyze/java/infer/ContextLeaks.java", "procedure": "void ContextLeaks.directLeak()" }, + { + "bug_type": "CONTEXT_LEAK", + "file": "codetoanalyze/java/infer/ContextLeaks.java", + "procedure": "ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context)" + }, { "bug_type": "CONTEXT_LEAK", "file": "codetoanalyze/java/infer/ContextLeaks.java", diff --git a/infer/tests/buck_report.json b/infer/tests/buck_report.json index 75a9b8f7e..116fd75a9 100644 --- a/infer/tests/buck_report.json +++ b/infer/tests/buck_report.json @@ -9,6 +9,11 @@ "file": "infer/tests/codetoanalyze/java/infer/ContextLeaks.java", "procedure": "void ContextLeaks.directLeak()" }, + { + "bug_type": "CONTEXT_LEAK", + "file": "infer/tests/codetoanalyze/java/infer/ContextLeaks.java", + "procedure": "ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context)" + }, { "bug_type": "CONTEXT_LEAK", "file": "infer/tests/codetoanalyze/java/infer/ContextLeaks.java", diff --git a/infer/tests/endtoend/java/infer/ContextLeaksTest.java b/infer/tests/endtoend/java/infer/ContextLeaksTest.java index 03ffdea81..77ef4b91f 100644 --- a/infer/tests/endtoend/java/infer/ContextLeaksTest.java +++ b/infer/tests/endtoend/java/infer/ContextLeaksTest.java @@ -45,7 +45,8 @@ public class ContextLeaksTest { "nonStaticInnerClassLeak", "leakAfterInstanceFieldWrite", "singletonLeak", - "indirectHandlerLeak" + "indirectHandlerLeak", + "getInstance", }; assertThat( "Results should contain " + CONTEXT_LEAK,