From 1a5ac9e62b536d15c65e0967a900e66508841636 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Tue, 20 Dec 2016 03:04:54 -0800 Subject: [PATCH] Use natural order on hpred, optionally ignoring instrumentation Reviewed By: jeremydubreil Differential Revision: D4243981 fbshipit-source-id: 825b910 --- infer/src/IR/Sil.re | 38 ++--------------- infer/src/IR/Sil.rei | 6 +-- infer/tests/build_systems/ant/issues.exp | 8 ++-- infer/tests/build_systems/buck/issues.exp | 8 ++-- infer/tests/build_systems/gradle/issues.exp | 2 +- .../build_systems/utf8_in_pwd/issues.exp | 2 +- .../tests/codetoanalyze/java/infer/issues.exp | 12 +++--- .../codetoanalyze/java/tracing/issues.exp | 42 +++++++++---------- .../codetoanalyze/objc/errors/issues.exp | 4 +- 9 files changed, 45 insertions(+), 77 deletions(-) diff --git a/infer/src/IR/Sil.re b/infer/src/IR/Sil.re index d26ff07ae..c3744d01b 100644 --- a/infer/src/IR/Sil.re +++ b/infer/src/IR/Sil.re @@ -131,16 +131,11 @@ type inst = | Ireturn_from_call int [@@deriving compare]; -/* some occurrences of inst are always ignored by compare */ -type _inst = inst; - -let compare__inst _ _ => 0; - /** structured expressions represent a value of structured type, such as an array or a struct. */ type strexp0 'inst = | Eexp Exp.t 'inst /** Base case: expression with instrumentation */ - | Estruct (list (Ident.fieldname, strexp0 _inst)) 'inst /** C structure */ + | Estruct (list (Ident.fieldname, strexp0 'inst)) 'inst /** C structure */ /** Array of given length There are two conditions imposed / used in the array case. First, if some index and value pair appears inside an array @@ -148,13 +143,13 @@ type strexp0 'inst = For instance, x |->[10 | e1: v1] implies that e1 <= 9. Second, if two indices appear in an array, they should be different. For instance, x |->[10 | e1: v1, e2: v2] implies that e1 != e2. */ - | Earray Exp.t (list (Exp.t, strexp0 _inst)) 'inst + | Earray Exp.t (list (Exp.t, strexp0 'inst)) 'inst [@@deriving compare]; type strexp = strexp0 inst; let compare_strexp inst::inst=false se1 se2 => - compare_strexp0 (inst ? compare_inst : compare__inst) se1 se2; + compare_strexp0 (inst ? compare_inst : (fun _ _ => 0)) se1 se2; let equal_strexp inst::inst=false se1 se2 => compare_strexp inst::inst se1 se2 == 0; @@ -204,32 +199,7 @@ type hpred = hpred0 inst; /** Comparsion between heap predicates. Reverse natural order, and order first by anchor exp. */ let compare_hpred inst::inst=false hpred1 hpred2 => - if (phys_equal hpred1 hpred2) { - 0 - } else { - switch (hpred1, hpred2) { - | ( - Hpointsto e1 _ _ | Hlseg _ _ e1 _ _ | Hdllseg _ _ e1 _ _ _ _, - Hpointsto e2 _ _ | Hlseg _ _ e2 _ _ | Hdllseg _ _ e2 _ _ _ _ - ) - when Exp.compare e2 e1 != 0 => - Exp.compare e2 e1 - | (Hpointsto _, Hpointsto _) - | (Hlseg _, Hlseg _) - | (Hdllseg _, Hdllseg _) => - if inst { - compare_hpred0 compare_inst hpred2 hpred1 - } else { - compare_hpred0 (fun _ _ => 0) hpred2 hpred1 - } - | _ => - if inst { - compare_hpred0 compare_inst hpred1 hpred2 - } else { - compare_hpred0 (fun _ _ => 0) hpred1 hpred2 - } - } - }; + compare_hpred0 (inst ? compare_inst : (fun _ _ => 0)) hpred1 hpred2; let equal_hpred inst::inst=false hpred1 hpred2 => compare_hpred inst::inst hpred1 hpred2 == 0; diff --git a/infer/src/IR/Sil.rei b/infer/src/IR/Sil.rei index 453cc475f..ccff829a8 100644 --- a/infer/src/IR/Sil.rei +++ b/infer/src/IR/Sil.rei @@ -176,13 +176,11 @@ let inst_partial_join: inst => inst => inst; /** meet of instrumentations */ let inst_partial_meet: inst => inst => inst; -type _inst = inst; - /** structured expressions represent a value of structured type, such as an array or a struct. */ type strexp0 'inst = | Eexp Exp.t 'inst /** Base case: expression with instrumentation */ - | Estruct (list (Ident.fieldname, strexp0 _inst)) 'inst /** C structure */ + | Estruct (list (Ident.fieldname, strexp0 'inst)) 'inst /** C structure */ /** Array of given length There are two conditions imposed / used in the array case. First, if some index and value pair appears inside an array @@ -190,7 +188,7 @@ type strexp0 'inst = For instance, x |->[10 | e1: v1] implies that e1 <= 9. Second, if two indices appear in an array, they should be different. For instance, x |->[10 | e1: v1, e2: v2] implies that e1 != e2. */ - | Earray Exp.t (list (Exp.t, strexp0 _inst)) 'inst + | Earray Exp.t (list (Exp.t, strexp0 'inst)) 'inst [@@deriving compare]; type strexp = strexp0 inst; diff --git a/infer/tests/build_systems/ant/issues.exp b/infer/tests/build_systems/ant/issues.exp index 66b294d8c..8b3ebc6b8 100644 --- a/infer/tests/build_systems/ant/issues.exp +++ b/infer/tests/build_systems/ant/issues.exp @@ -10,8 +10,8 @@ codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResour codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.notClosingWrapper(), 2, RESOURCE_LEAK, [start of procedure notClosingWrapper(),start of procedure Resource(),return from a call to Resource.(),start of procedure Sub(...),start of procedure Wrapper(...),return from a call to Wrapper.(Resource),return from a call to Sub.(Resource),start of procedure close(),return from a call to void Resource.close()] codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.skippedVritualCallDoesNotCloseResourceOnReceiver(), 2, RESOURCE_LEAK, [start of procedure skippedVritualCallDoesNotCloseResourceOnReceiver(),start of procedure SomeResource(),return from a call to SomeResource.()] codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.withException(), 4, RESOURCE_LEAK, [start of procedure withException(),start of procedure SomeResource(),return from a call to SomeResource.(),start of procedure doSomething(),Taking true branch,start of procedure LocalException(),return from a call to LocalException.(),exception codetoanalyze.java.infer.LocalException,return from a call to void SomeResource.doSomething()] -codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context), 4, CONTEXT_LEAK, [start of procedure getInstance(...),Taking true branch,start of procedure ContextLeaks$Singleton(...),return from a call to ContextLeaks$Singleton.(Context),return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context)] -codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks.singletonLeak(), 1, CONTEXT_LEAK, [start of procedure singletonLeak(),start of procedure getInstance(...),Taking true branch,start of procedure ContextLeaks$Singleton(...),return from a call to ContextLeaks$Singleton.(Context),return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context),return from a call to ContextLeaks$Singleton ContextLeaks.singletonLeak()] +codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context), 4, CONTEXT_LEAK, [start of procedure getInstance(...),Taking false branch,return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context)] +codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks.singletonLeak(), 1, CONTEXT_LEAK, [start of procedure singletonLeak(),start of procedure getInstance(...),Taking false branch,return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context),return from a call to ContextLeaks$Singleton ContextLeaks.singletonLeak()] codetoanalyze/java/infer/ContextLeaks.java, void ContextLeaks.directLeak(), 2, CONTEXT_LEAK, [start of procedure directLeak(),return from a call to void ContextLeaks.directLeak()] codetoanalyze/java/infer/ContextLeaks.java, void ContextLeaks.indirectLeak(), 4, CONTEXT_LEAK, [start of procedure indirectLeak(),start of procedure ContextLeaks$Obj(),return from a call to ContextLeaks$Obj.(),return from a call to void ContextLeaks.indirectLeak()] codetoanalyze/java/infer/ContextLeaks.java, void ContextLeaks.leakAfterInstanceFieldWrite(), 3, CONTEXT_LEAK, [start of procedure leakAfterInstanceFieldWrite(),return from a call to void ContextLeaks.leakAfterInstanceFieldWrite()] @@ -91,7 +91,7 @@ codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions. codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefNullableRet(boolean), 2, NULL_DEREFERENCE, [start of procedure derefNullableRet(...),start of procedure nullableRet(...),Taking true branch,return from a call to Object NullPointerExceptions.nullableRet(boolean)] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefUndefNullableRet(), 2, NULL_DEREFERENCE, [start of procedure derefUndefNullableRet()] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefUndefNullableRetWrapper(), 1, NULL_DEREFERENCE, [start of procedure derefUndefNullableRetWrapper(),start of procedure undefNullableWrapper(),return from a call to Object NullPointerExceptions.undefNullableWrapper()] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L), 2, NULL_DEREFERENCE, [start of procedure dereferenceAfterLoopOnList(...),start of procedure returnsNullAfterLoopOnList(...),Taking false branch,return from a call to Object NullPointerExceptions.returnsNullAfterLoopOnList(NullPointerExceptions$L)] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L), 2, NULL_DEREFERENCE, [start of procedure dereferenceAfterLoopOnList(...),start of procedure returnsNullAfterLoopOnList(...),Taking true branch,Taking true branch,Taking false branch,return from a call to Object NullPointerExceptions.returnsNullAfterLoopOnList(NullPointerExceptions$L)] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock1(Lock), 4, NULL_DEREFERENCE, [start of procedure dereferenceAfterUnlock1(...)] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock2(Lock), 6, NULL_DEREFERENCE, [start of procedure dereferenceAfterUnlock2(...)] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionArrayLength(), 2, NULL_DEREFERENCE, [start of procedure nullPointerExceptionArrayLength()] @@ -157,7 +157,7 @@ codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.scannerNotClosed codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.serverSocketNotClosed(), 12, RESOURCE_LEAK, [start of procedure serverSocketNotClosed(),exception java.io.IOException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.socketNotClosed(), 1, RESOURCE_LEAK, [start of procedure socketNotClosed()] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.themeObtainTypedArrayAndLeak(Resources$Theme), 2, RESOURCE_LEAK, [start of procedure themeObtainTypedArrayAndLeak(...),start of procedure ignore(...),return from a call to void ResourceLeaks.ignore(Object)] -codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResources(), 11, RESOURCE_LEAK, [start of procedure twoResources(),exception java.io.IOException,Switch condition is true. Entering switch case,Taking true branch,exception java.io.IOException] +codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResources(), 11, RESOURCE_LEAK, [start of procedure twoResources(),Taking true branch,exception java.io.IOException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResourcesRandomAccessFile(), 10, RESOURCE_LEAK, [start of procedure twoResourcesRandomAccessFile(),Taking true branch,exception java.io.IOException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResourcesServerSocket(), 10, RESOURCE_LEAK, [start of procedure twoResourcesServerSocket(),Taking true branch,exception java.io.IOException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.zipFileLeakExceptionalBranch(), 5, RESOURCE_LEAK, [start of procedure zipFileLeakExceptionalBranch(),exception java.io.IOException,Switch condition is true. Entering switch case] diff --git a/infer/tests/build_systems/buck/issues.exp b/infer/tests/build_systems/buck/issues.exp index fff3cc519..334aee61c 100644 --- a/infer/tests/build_systems/buck/issues.exp +++ b/infer/tests/build_systems/buck/issues.exp @@ -10,8 +10,8 @@ infer/tests/codetoanalyze/java/infer/CloseableAsResourceExample.java, void Close infer/tests/codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.notClosingWrapper(), 2, RESOURCE_LEAK, [start of procedure notClosingWrapper(),start of procedure Resource(),return from a call to Resource.(),start of procedure Sub(...),start of procedure Wrapper(...),return from a call to Wrapper.(Resource),return from a call to Sub.(Resource),start of procedure close(),return from a call to void Resource.close()] infer/tests/codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.skippedVritualCallDoesNotCloseResourceOnReceiver(), 2, RESOURCE_LEAK, [start of procedure skippedVritualCallDoesNotCloseResourceOnReceiver(),start of procedure SomeResource(),return from a call to SomeResource.()] infer/tests/codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.withException(), 4, RESOURCE_LEAK, [start of procedure withException(),start of procedure SomeResource(),return from a call to SomeResource.(),start of procedure doSomething(),Taking true branch,start of procedure LocalException(),return from a call to LocalException.(),exception codetoanalyze.java.infer.LocalException,return from a call to void SomeResource.doSomething()] -infer/tests/codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context), 4, CONTEXT_LEAK, [start of procedure getInstance(...),Taking true branch,start of procedure ContextLeaks$Singleton(...),return from a call to ContextLeaks$Singleton.(Context),return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context)] -infer/tests/codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks.singletonLeak(), 1, CONTEXT_LEAK, [start of procedure singletonLeak(),start of procedure getInstance(...),Taking true branch,start of procedure ContextLeaks$Singleton(...),return from a call to ContextLeaks$Singleton.(Context),return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context),return from a call to ContextLeaks$Singleton ContextLeaks.singletonLeak()] +infer/tests/codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context), 4, CONTEXT_LEAK, [start of procedure getInstance(...),Taking false branch,return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context)] +infer/tests/codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks.singletonLeak(), 1, CONTEXT_LEAK, [start of procedure singletonLeak(),start of procedure getInstance(...),Taking false branch,return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context),return from a call to ContextLeaks$Singleton ContextLeaks.singletonLeak()] infer/tests/codetoanalyze/java/infer/ContextLeaks.java, void ContextLeaks.directLeak(), 2, CONTEXT_LEAK, [start of procedure directLeak(),return from a call to void ContextLeaks.directLeak()] infer/tests/codetoanalyze/java/infer/ContextLeaks.java, void ContextLeaks.indirectLeak(), 4, CONTEXT_LEAK, [start of procedure indirectLeak(),start of procedure ContextLeaks$Obj(),return from a call to ContextLeaks$Obj.(),return from a call to void ContextLeaks.indirectLeak()] infer/tests/codetoanalyze/java/infer/ContextLeaks.java, void ContextLeaks.leakAfterInstanceFieldWrite(), 3, CONTEXT_LEAK, [start of procedure leakAfterInstanceFieldWrite(),return from a call to void ContextLeaks.leakAfterInstanceFieldWrite()] @@ -91,7 +91,7 @@ infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointe infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefNullableRet(boolean), 2, NULL_DEREFERENCE, [start of procedure derefNullableRet(...),start of procedure nullableRet(...),Taking true branch,return from a call to Object NullPointerExceptions.nullableRet(boolean)] infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefUndefNullableRet(), 2, NULL_DEREFERENCE, [start of procedure derefUndefNullableRet()] infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefUndefNullableRetWrapper(), 1, NULL_DEREFERENCE, [start of procedure derefUndefNullableRetWrapper(),start of procedure undefNullableWrapper(),return from a call to Object NullPointerExceptions.undefNullableWrapper()] -infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L), 2, NULL_DEREFERENCE, [start of procedure dereferenceAfterLoopOnList(...),start of procedure returnsNullAfterLoopOnList(...),Taking false branch,return from a call to Object NullPointerExceptions.returnsNullAfterLoopOnList(NullPointerExceptions$L)] +infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L), 2, NULL_DEREFERENCE, [start of procedure dereferenceAfterLoopOnList(...),start of procedure returnsNullAfterLoopOnList(...),Taking true branch,Taking true branch,Taking false branch,return from a call to Object NullPointerExceptions.returnsNullAfterLoopOnList(NullPointerExceptions$L)] infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock1(Lock), 4, NULL_DEREFERENCE, [start of procedure dereferenceAfterUnlock1(...)] infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock2(Lock), 6, NULL_DEREFERENCE, [start of procedure dereferenceAfterUnlock2(...)] infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionArrayLength(), 2, NULL_DEREFERENCE, [start of procedure nullPointerExceptionArrayLength()] @@ -157,7 +157,7 @@ infer/tests/codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.scan infer/tests/codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.serverSocketNotClosed(), 12, RESOURCE_LEAK, [start of procedure serverSocketNotClosed(),exception java.io.IOException] infer/tests/codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.socketNotClosed(), 1, RESOURCE_LEAK, [start of procedure socketNotClosed()] infer/tests/codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.themeObtainTypedArrayAndLeak(Resources$Theme), 2, RESOURCE_LEAK, [start of procedure themeObtainTypedArrayAndLeak(...),start of procedure ignore(...),return from a call to void ResourceLeaks.ignore(Object)] -infer/tests/codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResources(), 11, RESOURCE_LEAK, [start of procedure twoResources(),exception java.io.IOException,Switch condition is true. Entering switch case,Taking true branch,exception java.io.IOException] +infer/tests/codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResources(), 11, RESOURCE_LEAK, [start of procedure twoResources(),Taking true branch,exception java.io.IOException] infer/tests/codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResourcesRandomAccessFile(), 10, RESOURCE_LEAK, [start of procedure twoResourcesRandomAccessFile(),Taking true branch,exception java.io.IOException] infer/tests/codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResourcesServerSocket(), 10, RESOURCE_LEAK, [start of procedure twoResourcesServerSocket(),Taking true branch,exception java.io.IOException] infer/tests/codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.zipFileLeakExceptionalBranch(), 5, RESOURCE_LEAK, [start of procedure zipFileLeakExceptionalBranch(),exception java.io.IOException,Switch condition is true. Entering switch case] diff --git a/infer/tests/build_systems/gradle/issues.exp b/infer/tests/build_systems/gradle/issues.exp index b98fd771a..533ec4ed0 100644 --- a/infer/tests/build_systems/gradle/issues.exp +++ b/infer/tests/build_systems/gradle/issues.exp @@ -1,3 +1,3 @@ Hello.java, void Hello.mayCauseNPE(), 4, NULL_DEREFERENCE, [start of procedure mayCauseNPE(),start of procedure mayReturnNull(...),Taking false branch,return from a call to Pointers$A Pointers.mayReturnNull(int)] Hello.java, void Hello.mayLeakResource(), 7, RESOURCE_LEAK, [start of procedure mayLeakResource(),start of procedure allocateResource(),return from a call to FileOutputStream Resources.allocateResource(),Taking false branch] -Hello.java, void Hello.twoResources(), 11, RESOURCE_LEAK, [start of procedure twoResources(),exception java.io.IOException,Switch condition is true. Entering switch case,Taking true branch,exception java.io.IOException] +Hello.java, void Hello.twoResources(), 11, RESOURCE_LEAK, [start of procedure twoResources(),Taking true branch,exception java.io.IOException] diff --git a/infer/tests/build_systems/utf8_in_pwd/issues.exp b/infer/tests/build_systems/utf8_in_pwd/issues.exp index 69ed2eeef..084944f9a 100644 --- a/infer/tests/build_systems/utf8_in_pwd/issues.exp +++ b/infer/tests/build_systems/utf8_in_pwd/issues.exp @@ -1,6 +1,6 @@ hello.c, test, 2, NULL_DEREFERENCE, [start of procedure test()] Hello.java, void Hello.mayCauseNPE(), 4, NULL_DEREFERENCE, [start of procedure mayCauseNPE(),start of procedure mayReturnNull(...),Taking false branch,return from a call to Pointers$A Pointers.mayReturnNull(int)] Hello.java, void Hello.mayLeakResource(), 7, RESOURCE_LEAK, [start of procedure mayLeakResource(),start of procedure allocateResource(),return from a call to FileOutputStream Resources.allocateResource(),Taking false branch] -Hello.java, void Hello.twoResources(), 11, RESOURCE_LEAK, [start of procedure twoResources(),exception java.io.IOException,Switch condition is true. Entering switch case,Taking true branch,exception java.io.IOException] +Hello.java, void Hello.twoResources(), 11, RESOURCE_LEAK, [start of procedure twoResources(),Taking true branch,exception java.io.IOException] Hello.java, int Hello.test(), 2, NULL_DEREFERENCE, [start of procedure test()] utf8_in_function_names.c, test_성공, 2, NULL_DEREFERENCE, [start of procedure test_성공()] diff --git a/infer/tests/codetoanalyze/java/infer/issues.exp b/infer/tests/codetoanalyze/java/infer/issues.exp index db873ddf6..b0ddaa10f 100644 --- a/infer/tests/codetoanalyze/java/infer/issues.exp +++ b/infer/tests/codetoanalyze/java/infer/issues.exp @@ -19,7 +19,7 @@ codetoanalyze/java/infer/AnalysisStops.java, void AnalysisStops.skipPointerDeref codetoanalyze/java/infer/AnalysisStops.java, void AnalysisStops.skipPointerDerefMayCauseLocalFalseNegative(), 3, DIVIDE_BY_ZERO, [start of procedure skipPointerDerefMayCauseLocalFalseNegative()] codetoanalyze/java/infer/AnalysisStops.java, void AnalysisStops.specInferenceMayFailAndCauseFalseNegative(boolean,Iterator), 2, RETURN_VALUE_IGNORED, [start of procedure specInferenceMayFailAndCauseFalseNegative(...),start of procedure skipPointerDerefMayCauseLocalFalseNegative(),return from a call to void AnalysisStops.skipPointerDerefMayCauseLocalFalseNegative()] codetoanalyze/java/infer/AnalysisStops.java, void AnalysisStops.specInferenceMayFailAndCauseFalseNegative(boolean,Iterator), 3, RETURN_VALUE_IGNORED, [start of procedure specInferenceMayFailAndCauseFalseNegative(...),start of procedure skipPointerDerefMayCauseLocalFalseNegative(),return from a call to void AnalysisStops.skipPointerDerefMayCauseLocalFalseNegative(),start of procedure skipPointerDerefPreventsSpecInferenceRetObj(),return from a call to Object AnalysisStops.skipPointerDerefPreventsSpecInferenceRetObj()] -codetoanalyze/java/infer/AnalysisStops.java, void AnalysisStops.specInferenceMayFailAndCauseFalseNegative(boolean,Iterator), 26, DIVIDE_BY_ZERO, [start of procedure specInferenceMayFailAndCauseFalseNegative(...),start of procedure skipPointerDerefMayCauseLocalFalseNegative(),return from a call to void AnalysisStops.skipPointerDerefMayCauseLocalFalseNegative(),start of procedure skipPointerDerefPreventsSpecInferenceRetObj(),return from a call to Object AnalysisStops.skipPointerDerefPreventsSpecInferenceRetObj(),start of procedure skipPointerDerefPreventsSpecInferenceRetZero(),return from a call to int AnalysisStops.skipPointerDerefPreventsSpecInferenceRetZero(),start of procedure skipPointerDerefMayCauseCalleeFalseNegative(),start of procedure skipPointerDerefPreventsSpecInferenceRetZero(),return from a call to int AnalysisStops.skipPointerDerefPreventsSpecInferenceRetZero(),return from a call to void AnalysisStops.skipPointerDerefMayCauseCalleeFalseNegative(),start of procedure skipPointerDerefMayCauseInterprocFalseNegative(),start of procedure skipPointerDerefPreventsSpecInferenceRetZero(),return from a call to int AnalysisStops.skipPointerDerefPreventsSpecInferenceRetZero(),start of procedure divideByParam(...),return from a call to void AnalysisStops.divideByParam(int),return from a call to void AnalysisStops.skipPointerDerefMayCauseInterprocFalseNegative(),start of procedure castFailureOnUndefinedObjMayCauseFalseNegative(),start of procedure castExternalPreventsSpecInference(),return from a call to String AnalysisStops.castExternalPreventsSpecInference(),return from a call to void AnalysisStops.castFailureOnUndefinedObjMayCauseFalseNegative(),start of procedure callOnCastUndefinedObjMayCauseFalseNegative(),start of procedure castExternalPreventsSpecInference(),return from a call to String AnalysisStops.castExternalPreventsSpecInference(),return from a call to void AnalysisStops.callOnCastUndefinedObjMayCauseFalseNegative(),start of procedure callOnUndefinedObjMayCauseFalseNegative(),start of procedure retZero(),return from a call to int AnalysisStops$MyObj.retZero(),return from a call to void AnalysisStops.callOnUndefinedObjMayCauseFalseNegative(),start of procedure callOnUndefinedObjMayCauseFalsePositive(),start of procedure retOne(),return from a call to int AnalysisStops$MyObj.retOne(),return from a call to void AnalysisStops.callOnUndefinedObjMayCauseFalsePositive(),start of procedure fieldWriteOnUndefinedObjMayCauseFalseNegative(),return from a call to void AnalysisStops.fieldWriteOnUndefinedObjMayCauseFalseNegative(),start of procedure fieldWriteOnUndefinedObjMayCauseFalsePositive(),return from a call to void AnalysisStops.fieldWriteOnUndefinedObjMayCauseFalsePositive(),start of procedure fieldReadOnUndefinedObjMayCauseFalseNegative(),return from a call to void AnalysisStops.fieldReadOnUndefinedObjMayCauseFalseNegative(),start of procedure fieldReadOnUndefinedObjMayCauseFalsePositive(),return from a call to void AnalysisStops.fieldReadOnUndefinedObjMayCauseFalsePositive(),start of procedure infiniteMaterializationMayCauseFalseNegative(...),Taking false branch,return from a call to void AnalysisStops.infiniteMaterializationMayCauseFalseNegative(boolean),start of procedure infiniteMaterializationMayCauseFalsePositive(...),Taking false branch,return from a call to void AnalysisStops.infiniteMaterializationMayCauseFalsePositive(boolean),start of procedure primitiveFieldOfAngelicObjMayCauseFalsePositive(),Taking false branch,return from a call to void AnalysisStops.primitiveFieldOfAngelicObjMayCauseFalsePositive(),start of procedure primitiveFieldOfAngelicObjMayCauseFalseNegative(),Taking true branch,return from a call to void AnalysisStops.primitiveFieldOfAngelicObjMayCauseFalseNegative(),start of procedure heapFieldOfAngelicObjMayCauseFalsePositive(),Taking false branch,return from a call to void AnalysisStops.heapFieldOfAngelicObjMayCauseFalsePositive(),start of procedure heapFieldOfAngelicObjMayCauseFalseNegative(),Taking true branch,return from a call to void AnalysisStops.heapFieldOfAngelicObjMayCauseFalseNegative(),start of procedure fieldReadAferCastMayCauseFalseNegative(...),Taking true branch,return from a call to void AnalysisStops.fieldReadAferCastMayCauseFalseNegative(Iterator),start of procedure fieldReadInCalleeMayCauseFalsePositive(),start of procedure derefParam(...),return from a call to void AnalysisStops.derefParam(AnalysisStops$MyObj),return from a call to void AnalysisStops.fieldReadInCalleeMayCauseFalsePositive(),start of procedure fieldReadInCalleeWithAngelicObjFieldMayCauseFalsePositive(),start of procedure derefParam(...),return from a call to void AnalysisStops.derefParam(AnalysisStops$MyObj),return from a call to void AnalysisStops.fieldReadInCalleeWithAngelicObjFieldMayCauseFalsePositive(),start of procedure accessPathInCalleeMayCauseFalsePositive(),start of procedure accessPathOnParam(...),return from a call to void AnalysisStops.accessPathOnParam(AnalysisStops$MyObj),return from a call to void AnalysisStops.accessPathInCalleeMayCauseFalsePositive()] +codetoanalyze/java/infer/AnalysisStops.java, void AnalysisStops.specInferenceMayFailAndCauseFalseNegative(boolean,Iterator), 26, DIVIDE_BY_ZERO, [start of procedure specInferenceMayFailAndCauseFalseNegative(...),start of procedure skipPointerDerefMayCauseLocalFalseNegative(),return from a call to void AnalysisStops.skipPointerDerefMayCauseLocalFalseNegative(),start of procedure skipPointerDerefPreventsSpecInferenceRetObj(),return from a call to Object AnalysisStops.skipPointerDerefPreventsSpecInferenceRetObj(),start of procedure skipPointerDerefPreventsSpecInferenceRetZero(),return from a call to int AnalysisStops.skipPointerDerefPreventsSpecInferenceRetZero(),start of procedure skipPointerDerefMayCauseCalleeFalseNegative(),start of procedure skipPointerDerefPreventsSpecInferenceRetZero(),return from a call to int AnalysisStops.skipPointerDerefPreventsSpecInferenceRetZero(),return from a call to void AnalysisStops.skipPointerDerefMayCauseCalleeFalseNegative(),start of procedure skipPointerDerefMayCauseInterprocFalseNegative(),start of procedure skipPointerDerefPreventsSpecInferenceRetZero(),return from a call to int AnalysisStops.skipPointerDerefPreventsSpecInferenceRetZero(),start of procedure divideByParam(...),return from a call to void AnalysisStops.divideByParam(int),return from a call to void AnalysisStops.skipPointerDerefMayCauseInterprocFalseNegative(),start of procedure castFailureOnUndefinedObjMayCauseFalseNegative(),start of procedure castExternalPreventsSpecInference(),return from a call to String AnalysisStops.castExternalPreventsSpecInference(),return from a call to void AnalysisStops.castFailureOnUndefinedObjMayCauseFalseNegative(),start of procedure callOnCastUndefinedObjMayCauseFalseNegative(),start of procedure castExternalPreventsSpecInference(),return from a call to String AnalysisStops.castExternalPreventsSpecInference(),return from a call to void AnalysisStops.callOnCastUndefinedObjMayCauseFalseNegative(),start of procedure callOnUndefinedObjMayCauseFalseNegative(),start of procedure retZero(),return from a call to int AnalysisStops$MyObj.retZero(),return from a call to void AnalysisStops.callOnUndefinedObjMayCauseFalseNegative(),start of procedure callOnUndefinedObjMayCauseFalsePositive(),start of procedure retOne(),return from a call to int AnalysisStops$MyObj.retOne(),return from a call to void AnalysisStops.callOnUndefinedObjMayCauseFalsePositive(),start of procedure fieldWriteOnUndefinedObjMayCauseFalseNegative(),return from a call to void AnalysisStops.fieldWriteOnUndefinedObjMayCauseFalseNegative(),start of procedure fieldWriteOnUndefinedObjMayCauseFalsePositive(),return from a call to void AnalysisStops.fieldWriteOnUndefinedObjMayCauseFalsePositive(),start of procedure fieldReadOnUndefinedObjMayCauseFalseNegative(),return from a call to void AnalysisStops.fieldReadOnUndefinedObjMayCauseFalseNegative(),start of procedure fieldReadOnUndefinedObjMayCauseFalsePositive(),return from a call to void AnalysisStops.fieldReadOnUndefinedObjMayCauseFalsePositive(),start of procedure infiniteMaterializationMayCauseFalseNegative(...),Taking false branch,return from a call to void AnalysisStops.infiniteMaterializationMayCauseFalseNegative(boolean),start of procedure infiniteMaterializationMayCauseFalsePositive(...),Taking false branch,return from a call to void AnalysisStops.infiniteMaterializationMayCauseFalsePositive(boolean),start of procedure primitiveFieldOfAngelicObjMayCauseFalsePositive(),Taking true branch,return from a call to void AnalysisStops.primitiveFieldOfAngelicObjMayCauseFalsePositive(),start of procedure primitiveFieldOfAngelicObjMayCauseFalseNegative(),Taking false branch,return from a call to void AnalysisStops.primitiveFieldOfAngelicObjMayCauseFalseNegative(),start of procedure heapFieldOfAngelicObjMayCauseFalsePositive(),Taking false branch,return from a call to void AnalysisStops.heapFieldOfAngelicObjMayCauseFalsePositive(),start of procedure heapFieldOfAngelicObjMayCauseFalseNegative(),Taking true branch,return from a call to void AnalysisStops.heapFieldOfAngelicObjMayCauseFalseNegative(),start of procedure fieldReadAferCastMayCauseFalseNegative(...),Taking false branch,return from a call to void AnalysisStops.fieldReadAferCastMayCauseFalseNegative(Iterator),start of procedure fieldReadInCalleeMayCauseFalsePositive(),start of procedure derefParam(...),return from a call to void AnalysisStops.derefParam(AnalysisStops$MyObj),return from a call to void AnalysisStops.fieldReadInCalleeMayCauseFalsePositive(),start of procedure fieldReadInCalleeWithAngelicObjFieldMayCauseFalsePositive(),start of procedure derefParam(...),return from a call to void AnalysisStops.derefParam(AnalysisStops$MyObj),return from a call to void AnalysisStops.fieldReadInCalleeWithAngelicObjFieldMayCauseFalsePositive(),start of procedure accessPathInCalleeMayCauseFalsePositive(),start of procedure accessPathOnParam(...),return from a call to void AnalysisStops.accessPathOnParam(AnalysisStops$MyObj),return from a call to void AnalysisStops.accessPathInCalleeMayCauseFalsePositive()] codetoanalyze/java/infer/ArrayOutOfBounds.java, int ArrayOutOfBounds.arrayOutOfBounds(), 2, ARRAY_OUT_OF_BOUNDS_L1, [start of procedure arrayOutOfBounds()] codetoanalyze/java/infer/Builtins.java, void Builtins.causeError(Object), 2, NULL_DEREFERENCE, [start of procedure causeError(...),Taking true branch] codetoanalyze/java/infer/Builtins.java, void Builtins.doNotBlockError(Object), 3, NULL_DEREFERENCE, [start of procedure doNotBlockError(...),Taking true branch] @@ -35,8 +35,8 @@ codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResour codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.notClosingWrapper(), 2, RESOURCE_LEAK, [start of procedure notClosingWrapper(),start of procedure Resource(),return from a call to Resource.(),start of procedure Sub(...),start of procedure Wrapper(...),return from a call to Wrapper.(Resource),return from a call to Sub.(Resource),start of procedure close(),return from a call to void Resource.close()] codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.skippedVritualCallDoesNotCloseResourceOnReceiver(), 2, RESOURCE_LEAK, [start of procedure skippedVritualCallDoesNotCloseResourceOnReceiver(),start of procedure SomeResource(),return from a call to SomeResource.()] codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.withException(), 4, RESOURCE_LEAK, [start of procedure withException(),start of procedure SomeResource(),return from a call to SomeResource.(),start of procedure doSomething(),Taking true branch,start of procedure LocalException(),return from a call to LocalException.(),exception codetoanalyze.java.infer.LocalException,return from a call to void SomeResource.doSomething()] -codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context), 4, CONTEXT_LEAK, [start of procedure getInstance(...),Taking true branch,start of procedure ContextLeaks$Singleton(...),return from a call to ContextLeaks$Singleton.(Context),return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context)] -codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks.singletonLeak(), 1, CONTEXT_LEAK, [start of procedure singletonLeak(),start of procedure getInstance(...),Taking true branch,start of procedure ContextLeaks$Singleton(...),return from a call to ContextLeaks$Singleton.(Context),return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context),return from a call to ContextLeaks$Singleton ContextLeaks.singletonLeak()] +codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context), 4, CONTEXT_LEAK, [start of procedure getInstance(...),Taking false branch,return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context)] +codetoanalyze/java/infer/ContextLeaks.java, ContextLeaks$Singleton ContextLeaks.singletonLeak(), 1, CONTEXT_LEAK, [start of procedure singletonLeak(),start of procedure getInstance(...),Taking false branch,return from a call to ContextLeaks$Singleton ContextLeaks$Singleton.getInstance(Context),return from a call to ContextLeaks$Singleton ContextLeaks.singletonLeak()] codetoanalyze/java/infer/ContextLeaks.java, void ContextLeaks.directLeak(), 2, CONTEXT_LEAK, [start of procedure directLeak(),return from a call to void ContextLeaks.directLeak()] codetoanalyze/java/infer/ContextLeaks.java, void ContextLeaks.indirectLeak(), 4, CONTEXT_LEAK, [start of procedure indirectLeak(),start of procedure ContextLeaks$Obj(),return from a call to ContextLeaks$Obj.(),return from a call to void ContextLeaks.indirectLeak()] codetoanalyze/java/infer/ContextLeaks.java, void ContextLeaks.leakAfterInstanceFieldWrite(), 3, CONTEXT_LEAK, [start of procedure leakAfterInstanceFieldWrite(),return from a call to void ContextLeaks.leakAfterInstanceFieldWrite()] @@ -170,7 +170,7 @@ codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions. codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefNullableRet(boolean), 2, NULL_DEREFERENCE, [start of procedure derefNullableRet(...),start of procedure nullableRet(...),Taking true branch,return from a call to Object NullPointerExceptions.nullableRet(boolean)] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefUndefNullableRet(), 2, NULL_DEREFERENCE, [start of procedure derefUndefNullableRet()] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefUndefNullableRetWrapper(), 1, NULL_DEREFERENCE, [start of procedure derefUndefNullableRetWrapper(),start of procedure undefNullableWrapper(),return from a call to Object NullPointerExceptions.undefNullableWrapper()] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L), 2, NULL_DEREFERENCE, [start of procedure dereferenceAfterLoopOnList(...),start of procedure returnsNullAfterLoopOnList(...),Taking false branch,return from a call to Object NullPointerExceptions.returnsNullAfterLoopOnList(NullPointerExceptions$L)] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L), 2, NULL_DEREFERENCE, [start of procedure dereferenceAfterLoopOnList(...),start of procedure returnsNullAfterLoopOnList(...),Taking true branch,Taking true branch,Taking false branch,return from a call to Object NullPointerExceptions.returnsNullAfterLoopOnList(NullPointerExceptions$L)] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock1(Lock), 4, NULL_DEREFERENCE, [start of procedure dereferenceAfterUnlock1(...)] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock2(Lock), 6, NULL_DEREFERENCE, [start of procedure dereferenceAfterUnlock2(...)] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.noNullPointerExceptionAfterSkipFunction(), 4, RETURN_VALUE_IGNORED, [start of procedure noNullPointerExceptionAfterSkipFunction(),start of procedure genericMethodSomewhereCheckingForNull(...),Taking false branch,return from a call to void NullPointerExceptions.genericMethodSomewhereCheckingForNull(String)] @@ -267,7 +267,7 @@ codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.objectOutputStre codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.openHttpURLConnectionNotDisconnected(), 7, RESOURCE_LEAK, [start of procedure openHttpURLConnectionNotDisconnected()] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.openHttpsURLConnectionNotDisconnected(), 3, RESOURCE_LEAK, [start of procedure openHttpsURLConnectionNotDisconnected()] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.parseFromInputStreamAndLeak(JsonFactory), 5, RESOURCE_LEAK, [start of procedure parseFromInputStreamAndLeak(...)] -codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.parseFromInputStreamAndLeak(JsonFactory), 10, NULL_TEST_AFTER_DEREFERENCE, [start of procedure parseFromInputStreamAndLeak(...),exception java.io.IOException,Switch condition is true. Entering switch case,Taking false branch] +codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.parseFromInputStreamAndLeak(JsonFactory), 10, NULL_TEST_AFTER_DEREFERENCE, [start of procedure parseFromInputStreamAndLeak(...),exception com.fasterxml.jackson.core.JsonParseException,Switch condition is true. Entering switch case,Taking false branch] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.pipedInputStreamClosed(PipedOutputStream), 4, RETURN_VALUE_IGNORED, [start of procedure pipedInputStreamClosed(...)] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.pipedInputStreamNotClosedAfterRead(PipedOutputStream), 4, RETURN_VALUE_IGNORED, [start of procedure pipedInputStreamNotClosedAfterRead(...)] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.pipedInputStreamNotClosedAfterRead(PipedOutputStream), 6, RESOURCE_LEAK, [start of procedure pipedInputStreamNotClosedAfterRead(...),exception java.io.IOException] @@ -276,7 +276,7 @@ codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.scannerNotClosed codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.serverSocketNotClosed(), 12, RESOURCE_LEAK, [start of procedure serverSocketNotClosed(),exception java.io.IOException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.socketNotClosed(), 1, RESOURCE_LEAK, [start of procedure socketNotClosed()] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.themeObtainTypedArrayAndLeak(Resources$Theme), 2, RESOURCE_LEAK, [start of procedure themeObtainTypedArrayAndLeak(...),start of procedure ignore(...),return from a call to void ResourceLeaks.ignore(Object)] -codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResources(), 11, RESOURCE_LEAK, [start of procedure twoResources(),exception java.io.IOException,Switch condition is true. Entering switch case,Taking true branch,exception java.io.IOException] +codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResources(), 11, RESOURCE_LEAK, [start of procedure twoResources(),Taking true branch,exception java.io.IOException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResourcesRandomAccessFile(), 10, RESOURCE_LEAK, [start of procedure twoResourcesRandomAccessFile(),Taking true branch,exception java.io.IOException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResourcesServerSocket(), 7, NULL_TEST_AFTER_DEREFERENCE, [start of procedure twoResourcesServerSocket(),Taking false branch] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.twoResourcesServerSocket(), 8, NULL_TEST_AFTER_DEREFERENCE, [start of procedure twoResourcesServerSocket(),Taking true branch,Taking false branch] diff --git a/infer/tests/codetoanalyze/java/tracing/issues.exp b/infer/tests/codetoanalyze/java/tracing/issues.exp index 35add519f..495e0dadd 100644 --- a/infer/tests/codetoanalyze/java/tracing/issues.exp +++ b/infer/tests/codetoanalyze/java/tracing/issues.exp @@ -13,28 +13,28 @@ codetoanalyze/java/infer/NullPointerExceptions.java, String NullPointerException codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullListFiles(String), 3, java.lang.NullPointerException, [start of procedure nullListFiles(...),Taking true branch,exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullListFiles(String)] codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullPointerException(), 2, java.lang.NullPointerException, [start of procedure nullPointerException(),exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullPointerException()] codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullPointerExceptionInterProc(), 2, java.lang.NullPointerException, [start of procedure nullPointerExceptionInterProc(),start of procedure canReturnNullObject(...),start of procedure NullPointerExceptions$A(...),return from a call to NullPointerExceptions$A.(NullPointerExceptions),Taking false branch,return from a call to NullPointerExceptions$A NullPointerExceptions.canReturnNullObject(boolean),exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullPointerExceptionInterProc()] -codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullPointerExceptionWithAChainOfFields(NullPointerExceptions$C), 2, java.lang.NullPointerException, [start of procedure nullPointerExceptionWithAChainOfFields(...),start of procedure NullPointerExceptions$B(...),return from a call to NullPointerExceptions$B.(NullPointerExceptions),Taking true branch,Taking true branch,Taking true branch,exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullPointerExceptionWithAChainOfFields(NullPointerExceptions$C)] -codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullPointerExceptionWithAChainOfFields(NullPointerExceptions$C), 2, java.lang.NullPointerException, [start of procedure nullPointerExceptionWithAChainOfFields(...),start of procedure NullPointerExceptions$B(...),return from a call to NullPointerExceptions$B.(NullPointerExceptions),Taking true branch,Taking true branch,Taking true branch,exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullPointerExceptionWithAChainOfFields(NullPointerExceptions$C)] +codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullPointerExceptionWithAChainOfFields(NullPointerExceptions$C), 2, java.lang.NullPointerException, [start of procedure nullPointerExceptionWithAChainOfFields(...),start of procedure NullPointerExceptions$B(...),return from a call to NullPointerExceptions$B.(NullPointerExceptions),exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullPointerExceptionWithAChainOfFields(NullPointerExceptions$C)] +codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullPointerExceptionWithAChainOfFields(NullPointerExceptions$C), 2, java.lang.NullPointerException, [start of procedure nullPointerExceptionWithAChainOfFields(...),start of procedure NullPointerExceptions$B(...),return from a call to NullPointerExceptions$B.(NullPointerExceptions),exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullPointerExceptionWithAChainOfFields(NullPointerExceptions$C)] codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullPointerExceptionWithArray(), 3, java.lang.NullPointerException, [start of procedure nullPointerExceptionWithArray(),Taking true branch,Taking true branch,Taking true branch,Taking true branch,exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullPointerExceptionWithArray()] codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullPointerExceptionWithExceptionHandling(boolean), 5, java.lang.NullPointerException, [start of procedure nullPointerExceptionWithExceptionHandling(...),Taking true branch,exception java.lang.Exception,Switch condition is true. Entering switch case,exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullPointerExceptionWithExceptionHandling(boolean)] codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.preconditionCheckStateTest(NullPointerExceptions$D), 1, PRECONDITION_NOT_MET, [start of procedure preconditionCheckStateTest(...),Taking false branch] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions$$$Class$Name$With$Dollars.npeWithDollars(), 3, java.lang.NullPointerException, [start of procedure npeWithDollars(),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions$$$Class$Name$With$Dollars.npeWithDollars()] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.badCheckShouldCauseNPE(), 2, java.lang.NullPointerException, [start of procedure badCheckShouldCauseNPE(),start of procedure getBool(),Taking false branch,return from a call to Boolean NullPointerExceptions.getBool(),Taking false branch,return from a call to void NullPointerExceptions.badCheckShouldCauseNPE()] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefNonThisGetterAfterCheckShouldNotCauseNPE(), 5, java.lang.NullPointerException, [start of procedure derefNonThisGetterAfterCheckShouldNotCauseNPE(),start of procedure NullPointerExceptions(),return from a call to NullPointerExceptions.(),Taking true branch,start of procedure getObj(),Taking true branch,return from a call to Object NullPointerExceptions.getObj(),Taking true branch,Taking true branch,start of procedure getObj(),Taking false branch,return from a call to Object NullPointerExceptions.getObj(),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.derefNonThisGetterAfterCheckShouldNotCauseNPE()] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.badCheckShouldCauseNPE(), 2, java.lang.NullPointerException, [start of procedure badCheckShouldCauseNPE(),start of procedure getBool(),Taking true branch,return from a call to Boolean NullPointerExceptions.getBool(),Taking true branch,start of procedure getObj(),Taking true branch,return from a call to Object NullPointerExceptions.getObj(),Taking true branch,return from a call to void NullPointerExceptions.badCheckShouldCauseNPE()] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefNonThisGetterAfterCheckShouldNotCauseNPE(), 5, java.lang.NullPointerException, [start of procedure derefNonThisGetterAfterCheckShouldNotCauseNPE(),start of procedure NullPointerExceptions(),return from a call to NullPointerExceptions.(),Taking true branch,start of procedure getObj(),Taking true branch,return from a call to Object NullPointerExceptions.getObj(),Taking true branch,Taking true branch,start of procedure getObj(),Taking true branch,return from a call to Object NullPointerExceptions.getObj(),Taking true branch,return from a call to void NullPointerExceptions.derefNonThisGetterAfterCheckShouldNotCauseNPE()] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefNull(), 3, java.lang.NullPointerException, [start of procedure derefNull(),start of procedure derefUndefinedCallee(),start of procedure retUndefined(),Taking true branch,return from a call to Object NullPointerExceptions.retUndefined(),Taking true branch,return from a call to Object NullPointerExceptions.derefUndefinedCallee(),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.derefNull()] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefUndefNullableRetWrapper(), 2, java.lang.NullPointerException, [start of procedure derefUndefNullableRetWrapper(),start of procedure undefNullableWrapper(),return from a call to Object NullPointerExceptions.undefNullableWrapper(),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.derefUndefNullableRetWrapper()] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L), 3, java.lang.NullPointerException, [start of procedure dereferenceAfterLoopOnList(...),start of procedure returnsNullAfterLoopOnList(...),Taking true branch,Taking true branch,Taking true branch,Taking true branch,Taking false branch,return from a call to Object NullPointerExceptions.returnsNullAfterLoopOnList(NullPointerExceptions$L),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L)] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L), 3, java.lang.NullPointerException, [start of procedure dereferenceAfterLoopOnList(...),start of procedure returnsNullAfterLoopOnList(...),Taking true branch,Taking true branch,Taking true branch,Taking true branch,Taking false branch,return from a call to Object NullPointerExceptions.returnsNullAfterLoopOnList(NullPointerExceptions$L),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L)] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock1(Lock), 5, java.lang.NullPointerException, [start of procedure dereferenceAfterUnlock1(...),Taking true branch,Taking true branch,exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterUnlock1(Lock)] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock1(Lock), 5, java.lang.NullPointerException, [start of procedure dereferenceAfterUnlock1(...),Taking true branch,Taking true branch,exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterUnlock1(Lock)] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock2(Lock), 7, java.lang.NullPointerException, [start of procedure dereferenceAfterUnlock2(...),Taking true branch,Taking true branch,Taking true branch,exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterUnlock2(Lock)] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock2(Lock), 7, java.lang.NullPointerException, [start of procedure dereferenceAfterUnlock2(...),Taking true branch,Taking true branch,Taking true branch,exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterUnlock2(Lock)] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.derefUndefNullableRetWrapper(), 2, java.lang.NullPointerException, [start of procedure derefUndefNullableRetWrapper(),start of procedure undefNullableWrapper(),return from a call to Object NullPointerExceptions.undefNullableWrapper(),Taking true branch,return from a call to void NullPointerExceptions.derefUndefNullableRetWrapper()] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L), 3, java.lang.NullPointerException, [start of procedure dereferenceAfterLoopOnList(...),start of procedure returnsNullAfterLoopOnList(...),Taking false branch,return from a call to Object NullPointerExceptions.returnsNullAfterLoopOnList(NullPointerExceptions$L),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L)] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L), 3, java.lang.NullPointerException, [start of procedure dereferenceAfterLoopOnList(...),start of procedure returnsNullAfterLoopOnList(...),Taking false branch,return from a call to Object NullPointerExceptions.returnsNullAfterLoopOnList(NullPointerExceptions$L),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterLoopOnList(NullPointerExceptions$L)] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock1(Lock), 5, java.lang.NullPointerException, [start of procedure dereferenceAfterUnlock1(...),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterUnlock1(Lock)] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock1(Lock), 5, java.lang.NullPointerException, [start of procedure dereferenceAfterUnlock1(...),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterUnlock1(Lock)] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock2(Lock), 7, java.lang.NullPointerException, [start of procedure dereferenceAfterUnlock2(...),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterUnlock2(Lock)] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.dereferenceAfterUnlock2(Lock), 7, java.lang.NullPointerException, [start of procedure dereferenceAfterUnlock2(...),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.dereferenceAfterUnlock2(Lock)] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.noNullPointerExceptionAfterSkipFunction(), 4, RETURN_VALUE_IGNORED, [start of procedure noNullPointerExceptionAfterSkipFunction(),Taking true branch,start of procedure genericMethodSomewhereCheckingForNull(...),Taking false branch,return from a call to void NullPointerExceptions.genericMethodSomewhereCheckingForNull(String),Taking true branch] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionArrayLength(), 3, java.lang.NullPointerException, [start of procedure nullPointerExceptionArrayLength(),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.nullPointerExceptionArrayLength()] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionCallArrayReadMethod(), 3, java.lang.NullPointerException, [start of procedure nullPointerExceptionCallArrayReadMethod(),Taking true branch,Taking true branch,start of procedure arrayReadShouldNotCauseSymexMemoryError(...),Taking true branch,Taking true branch,Taking true branch,return from a call to Object NullPointerExceptions.arrayReadShouldNotCauseSymexMemoryError(int),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.nullPointerExceptionCallArrayReadMethod()] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionCallArrayReadMethod(), 3, java.lang.NullPointerException, [start of procedure nullPointerExceptionCallArrayReadMethod(),Taking true branch,Taking true branch,start of procedure arrayReadShouldNotCauseSymexMemoryError(...),Taking true branch,Taking true branch,Taking true branch,return from a call to Object NullPointerExceptions.arrayReadShouldNotCauseSymexMemoryError(int),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.nullPointerExceptionCallArrayReadMethod()] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionFromFailingFileOutputStreamConstructor(), 9, java.lang.NullPointerException, [start of procedure nullPointerExceptionFromFailingFileOutputStreamConstructor(),Taking true branch,exception java.io.IOException,return from a call to void NullPointerExceptions.nullPointerExceptionFromFailingFileOutputStreamConstructor()] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionFromFaillingResourceConstructor(), 8, java.lang.NullPointerException, [start of procedure nullPointerExceptionFromFaillingResourceConstructor(),Taking true branch,exception java.io.IOException,return from a call to void NullPointerExceptions.nullPointerExceptionFromFaillingResourceConstructor()] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionCallArrayReadMethod(), 3, java.lang.NullPointerException, [start of procedure nullPointerExceptionCallArrayReadMethod(),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.nullPointerExceptionCallArrayReadMethod()] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionCallArrayReadMethod(), 3, java.lang.NullPointerException, [start of procedure nullPointerExceptionCallArrayReadMethod(),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.nullPointerExceptionCallArrayReadMethod()] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionFromFailingFileOutputStreamConstructor(), 9, java.lang.NullPointerException, [start of procedure nullPointerExceptionFromFailingFileOutputStreamConstructor(),Taking true branch,return from a call to void NullPointerExceptions.nullPointerExceptionFromFailingFileOutputStreamConstructor()] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionFromFaillingResourceConstructor(), 8, java.lang.NullPointerException, [start of procedure nullPointerExceptionFromFaillingResourceConstructor(),Taking true branch,return from a call to void NullPointerExceptions.nullPointerExceptionFromFaillingResourceConstructor()] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionUnlessFrameFails(), 6, java.lang.NullPointerException, [start of procedure nullPointerExceptionUnlessFrameFails(),start of procedure NullPointerExceptions$A(...),return from a call to NullPointerExceptions$A.(NullPointerExceptions),start of procedure frame(...),start of procedure id_generics(...),Taking true branch,return from a call to Object NullPointerExceptions.id_generics(NullPointerExceptions$A),Taking true branch,return from a call to NullPointerExceptions$A NullPointerExceptions.frame(NullPointerExceptions$A),Taking true branch,exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.nullPointerExceptionUnlessFrameFails()] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionWithNullArrayParameter(), 2, java.lang.NullPointerException, [start of procedure nullPointerExceptionWithNullArrayParameter(),start of procedure expectNotNullArrayParameter(...),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.expectNotNullArrayParameter(codetoanalyze.java.infer.NullPointerExceptions$A[]),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.nullPointerExceptionWithNullArrayParameter()] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.nullPointerExceptionWithNullObjectParameter(), 2, java.lang.NullPointerException, [start of procedure nullPointerExceptionWithNullObjectParameter(),start of procedure expectNotNullObjectParameter(...),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.expectNotNullObjectParameter(NullPointerExceptions$A),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.nullPointerExceptionWithNullObjectParameter()] @@ -42,16 +42,16 @@ codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions. codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.someNPEAfterResourceLeak(), 3, java.lang.NullPointerException, [start of procedure someNPEAfterResourceLeak(),start of procedure sourceOfNullWithResourceLeak(),start of procedure SomeResource(),return from a call to SomeResource.(),return from a call to T CloseableAsResourceExample.sourceOfNullWithResourceLeak(),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.someNPEAfterResourceLeak()] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.stringConstantEqualsFalseNotNPE_FP(), 11, java.lang.NullPointerException, [start of procedure stringConstantEqualsFalseNotNPE_FP(),Taking true branch,Taking true branch,Taking true branch,return from a call to void NullPointerExceptions.stringConstantEqualsFalseNotNPE_FP()] codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.testSystemGetPropertyReturn(), 2, RETURN_VALUE_IGNORED, [start of procedure testSystemGetPropertyReturn(),Taking true branch] -codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.testSystemGetPropertyReturn(), 3, java.lang.NullPointerException, [start of procedure testSystemGetPropertyReturn(),exception java.lang.NullPointerException,return from a call to void NullPointerExceptions.testSystemGetPropertyReturn()] -codetoanalyze/java/tracing/ArrayIndexOutOfBoundsExceptionExample.java, void ArrayIndexOutOfBoundsExceptionExample.arrayIndexOutOfBoundsInCallee(), 3, java.lang.ArrayIndexOutOfBoundsException, [start of procedure arrayIndexOutOfBoundsInCallee(),start of procedure withFixedIndex(...),start of procedure callMethodFromArray(...),Taking true branch,Taking true branch,Taking true branch,Taking true branch,Taking true branch,Taking true branch,start of procedure f(),return from a call to void T2.f(),return from a call to void ArrayIndexOutOfBoundsExceptionExample.callMethodFromArray(codetoanalyze.java.tracing.T2[],int),return from a call to void ArrayIndexOutOfBoundsExceptionExample.withFixedIndex(codetoanalyze.java.tracing.T2[]),return from a call to void ArrayIndexOutOfBoundsExceptionExample.arrayIndexOutOfBoundsInCallee()] +codetoanalyze/java/infer/NullPointerExceptions.java, void NullPointerExceptions.testSystemGetPropertyReturn(), 3, java.lang.NullPointerException, [start of procedure testSystemGetPropertyReturn(),Taking true branch,return from a call to void NullPointerExceptions.testSystemGetPropertyReturn()] +codetoanalyze/java/tracing/ArrayIndexOutOfBoundsExceptionExample.java, void ArrayIndexOutOfBoundsExceptionExample.arrayIndexOutOfBoundsInCallee(), 3, java.lang.ArrayIndexOutOfBoundsException, [start of procedure arrayIndexOutOfBoundsInCallee(),start of procedure withFixedIndex(...),start of procedure callMethodFromArray(...),Taking true branch,Taking true branch,Taking false branch,return from a call to void ArrayIndexOutOfBoundsExceptionExample.callMethodFromArray(codetoanalyze.java.tracing.T2[],int),return from a call to void ArrayIndexOutOfBoundsExceptionExample.withFixedIndex(codetoanalyze.java.tracing.T2[]),return from a call to void ArrayIndexOutOfBoundsExceptionExample.arrayIndexOutOfBoundsInCallee()] codetoanalyze/java/tracing/ArrayIndexOutOfBoundsExceptionExample.java, void ArrayIndexOutOfBoundsExceptionExample.callOutOfBound(), 3, java.lang.ArrayIndexOutOfBoundsException, [start of procedure callOutOfBound(),start of procedure callMethodFromArray(...),Taking true branch,exception java.lang.ArrayIndexOutOfBoundsException,return from a call to void ArrayIndexOutOfBoundsExceptionExample.callMethodFromArray(codetoanalyze.java.tracing.T2[],int),exception java.lang.ArrayIndexOutOfBoundsException,return from a call to void ArrayIndexOutOfBoundsExceptionExample.callOutOfBound()] -codetoanalyze/java/tracing/ArrayIndexOutOfBoundsExceptionExample.java, void ArrayIndexOutOfBoundsExceptionExample.missingCheckOnIndex(codetoanalyze.java.tracing.T2[],int), 6, java.lang.ArrayIndexOutOfBoundsException, [start of procedure missingCheckOnIndex(...),Taking true branch,Taking true branch,Taking true branch,start of procedure callMethodFromArray(...),Taking true branch,exception java.lang.ArrayIndexOutOfBoundsException,return from a call to void ArrayIndexOutOfBoundsExceptionExample.callMethodFromArray(codetoanalyze.java.tracing.T2[],int),exception java.lang.ArrayIndexOutOfBoundsException,return from a call to void ArrayIndexOutOfBoundsExceptionExample.missingCheckOnIndex(codetoanalyze.java.tracing.T2[],int)] -codetoanalyze/java/tracing/ClassCastExceptionExample.java, S ClassCastExceptionExample.bar(int), 4, java.lang.ClassCastException, [start of procedure bar(...),Taking true branch,Taking true branch,exception java.lang.ClassCastException,return from a call to S ClassCastExceptionExample.bar(int)] +codetoanalyze/java/tracing/ArrayIndexOutOfBoundsExceptionExample.java, void ArrayIndexOutOfBoundsExceptionExample.missingCheckOnIndex(codetoanalyze.java.tracing.T2[],int), 6, java.lang.ArrayIndexOutOfBoundsException, [start of procedure missingCheckOnIndex(...),Taking false branch,return from a call to void ArrayIndexOutOfBoundsExceptionExample.missingCheckOnIndex(codetoanalyze.java.tracing.T2[],int)] +codetoanalyze/java/tracing/ClassCastExceptionExample.java, S ClassCastExceptionExample.bar(int), 4, java.lang.ClassCastException, [start of procedure bar(...),Taking false branch,return from a call to S ClassCastExceptionExample.bar(int)] codetoanalyze/java/tracing/ClassCastExceptionExample.java, void ClassCastExceptionExample.foo(), 4, java.lang.ClassCastException, [start of procedure foo(),start of procedure T2(),return from a call to T2.(),start of procedure cast(...),exception java.lang.ClassCastException,return from a call to S ClassCastExceptionExample.cast(T2),exception java.lang.ClassCastException,return from a call to void ClassCastExceptionExample.foo()] codetoanalyze/java/tracing/LazyDynamicDispatchExample.java, void LazyDynamicDispatchExample.callWithSubtype(), 3, java.lang.NullPointerException, [start of procedure callWithSubtype(),start of procedure B(),start of procedure A(),return from a call to A.(),return from a call to B.(),start of procedure fromSupertype(...),Taking true branch,start of procedure get(),return from a call to T2 B.get(),return from a call to T2 LazyDynamicDispatchExample.fromSupertype(B),exception java.lang.NullPointerException,return from a call to void LazyDynamicDispatchExample.callWithSubtype()] codetoanalyze/java/tracing/LazyDynamicDispatchExample.java, void LazyDynamicDispatchExample.shouldReportLocalVarTypeIsKnown(), 3, java.lang.NullPointerException, [start of procedure shouldReportLocalVarTypeIsKnown(),start of procedure B(),start of procedure A(),return from a call to A.(),return from a call to B.(),start of procedure fromInterface(...),Taking true branch,start of procedure get(),return from a call to T2 B.get(),return from a call to T2 LazyDynamicDispatchExample.fromInterface(B),exception java.lang.NullPointerException,return from a call to void LazyDynamicDispatchExample.shouldReportLocalVarTypeIsKnown()] -codetoanalyze/java/tracing/LocallyDefinedExceptionExample.java, void LocallyDefinedExceptionExample.fieldInvariant(), 8, codetoanalyze.java.tracing.LocallyDefinedException, [start of procedure fieldInvariant(),Taking true branch,Taking true branch,Taking true branch,start of procedure LocallyDefinedException(...),return from a call to LocallyDefinedException.(String),Taking true branch,exception codetoanalyze.java.tracing.LocallyDefinedException,return from a call to void LocallyDefinedExceptionExample.fieldInvariant()] -codetoanalyze/java/tracing/NullPointerExceptionExample.java, void NullPointerExceptionExample.callDeref(T2,boolean), 4, java.lang.NullPointerException, [start of procedure callDeref(...),Taking true branch,start of procedure deref(...),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.deref(T2),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.callDeref(T2,boolean)] +codetoanalyze/java/tracing/LocallyDefinedExceptionExample.java, void LocallyDefinedExceptionExample.fieldInvariant(), 8, codetoanalyze.java.tracing.LocallyDefinedException, [start of procedure fieldInvariant(),Taking false branch,return from a call to void LocallyDefinedExceptionExample.fieldInvariant()] +codetoanalyze/java/tracing/NullPointerExceptionExample.java, void NullPointerExceptionExample.callDeref(T2,boolean), 4, java.lang.NullPointerException, [start of procedure callDeref(...),Taking false branch,return from a call to void NullPointerExceptionExample.callDeref(T2,boolean)] codetoanalyze/java/tracing/NullPointerExceptionExample.java, void NullPointerExceptionExample.callLeadToNpe(), 2, java.lang.NullPointerException, [start of procedure callLeadToNpe(),start of procedure callDeref(...),Taking true branch,start of procedure deref(...),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.deref(T2),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.callDeref(T2,boolean),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.callLeadToNpe()] codetoanalyze/java/tracing/NullPointerExceptionExample.java, void NullPointerExceptionExample.npeOnBothBranches(int), 6, java.lang.NullPointerException, [start of procedure npeOnBothBranches(...),Taking true branch,Taking true branch,Taking true branch,start of procedure callDeref(...),Taking true branch,start of procedure deref(...),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.deref(T2),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.callDeref(T2,boolean),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.npeOnBothBranches(int)] codetoanalyze/java/tracing/NullPointerExceptionExample.java, void NullPointerExceptionExample.npeOnBothBranches(int), 6, java.lang.NullPointerException, [start of procedure npeOnBothBranches(...),Taking true branch,Taking true branch,Taking true branch,start of procedure callDeref(...),Taking true branch,start of procedure deref(...),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.deref(T2),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.callDeref(T2,boolean),exception java.lang.NullPointerException,return from a call to void NullPointerExceptionExample.npeOnBothBranches(int)] diff --git a/infer/tests/codetoanalyze/objc/errors/issues.exp b/infer/tests/codetoanalyze/objc/errors/issues.exp index 58e0536b5..9f3374144 100644 --- a/infer/tests/codetoanalyze/objc/errors/issues.exp +++ b/infer/tests/codetoanalyze/objc/errors/issues.exp @@ -15,9 +15,9 @@ codetoanalyze/objc/errors/procdescs/main.c, call_nslog, 2, MEMORY_LEAK, [start o codetoanalyze/objc/errors/procdescs/main.c, call_nslog, 3, MEMORY_LEAK, [start of procedure call_nslog()] codetoanalyze/objc/errors/property/main.c, property_main, 2, MEMORY_LEAK, [start of procedure property_main()] codetoanalyze/objc/errors/property/main.c, property_main, 3, MEMORY_LEAK, [start of procedure property_main()] -codetoanalyze/objc/errors/warnings/ParameterNotNullableExample.m, FBAudioRecorder_FBAudioInputCallbackChain:, 2, IVAR_NOT_NULL_CHECKED, [start of procedure FBAudioInputCallbackChain:,Message recordState with receiver nil returns nil.] +codetoanalyze/objc/errors/warnings/ParameterNotNullableExample.m, FBAudioRecorder_FBAudioInputCallbackChain:, 2, NULL_DEREFERENCE, [start of procedure FBAudioInputCallbackChain:,Message recordState with receiver nil returns nil.] codetoanalyze/objc/errors/warnings/ParameterNotNullableExample.m, FBAudioRecorder_FBAudioInputCallbackChain:, 2, PARAMETER_NOT_NULL_CHECKED, [start of procedure FBAudioInputCallbackChain:,Message recorder with receiver nil returns nil. Message recordState with receiver nil returns nil.] -codetoanalyze/objc/errors/warnings/ParameterNotNullableExample.m, FBAudioRecorder_FBAudioInputCallbackField, 2, IVAR_NOT_NULL_CHECKED, [start of procedure FBAudioInputCallbackField,Message recordState with receiver nil returns nil.] +codetoanalyze/objc/errors/warnings/ParameterNotNullableExample.m, FBAudioRecorder_FBAudioInputCallbackField, 2, NULL_DEREFERENCE, [start of procedure FBAudioInputCallbackField,Message recordState with receiver nil returns nil.] codetoanalyze/objc/errors/warnings/ParameterNotNullableExample.m, FBAudioRecorder_FBAudioInputCallbackSimple:, 2, PARAMETER_NOT_NULL_CHECKED, [start of procedure FBAudioInputCallbackSimple:,Message recordState with receiver nil returns nil.] codetoanalyze/objc/errors/warnings/ParameterNotNullableExample.m, FBAudioRecorder_FBAudioInputCallbackSimpleAliasing:, 3, PARAMETER_NOT_NULL_CHECKED, [start of procedure FBAudioInputCallbackSimpleAliasing:,Message recordState with receiver nil returns nil.] codetoanalyze/objc/errors/warnings/ParameterNotNullableExample.m, FBAudioRecorder_test, 3, NULL_DEREFERENCE, [start of procedure test,Message recordState with receiver nil returns nil.]