[infer][java] no longer report the resource leaks when using the tracing mode

Summary: The point of the tracing mode is to compute all the possible path leading to an error state. However, within a method, many of those paths are not feasibile in practice. This leads to many false alarms for the resource leak analysis.

Reviewed By: sblackshear

Differential Revision: D5888695

fbshipit-source-id: 2dbc57b
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent 2f0068d180
commit 8740e8a11a

@ -1312,6 +1312,8 @@ let check_junk ?original_prop pname tenv prop =
-> (Config.curr_language_is Config.Java, exn_leak) -> (Config.curr_language_is Config.Java, exn_leak)
| Some _, Rignore | Some _, Rignore
-> (true, exn_leak) -> (true, exn_leak)
| Some _, Rfile when Config.tracing
-> (true, exn_leak)
| Some _, Rfile | Some _, Rfile
-> (false, exn_leak) -> (false, exn_leak)
| Some _, Rlock | Some _, Rlock

@ -2,13 +2,6 @@ codetoanalyze/java/infer/ArrayOutOfBounds.java, int ArrayOutOfBounds.arrayOutOfB
codetoanalyze/java/infer/ArrayOutOfBounds.java, void ArrayOutOfBounds.switchedArrsOutOfBounds(), 2, java.lang.ArrayIndexOutOfBoundsException, [start of procedure switchedArrsOutOfBounds(),start of procedure buggyIter(...),Taking true branch,Taking false branch,return from a call to void ArrayOutOfBounds.buggyIter(int[],int[]),return from a call to void ArrayOutOfBounds.switchedArrsOutOfBounds()] codetoanalyze/java/infer/ArrayOutOfBounds.java, void ArrayOutOfBounds.switchedArrsOutOfBounds(), 2, java.lang.ArrayIndexOutOfBoundsException, [start of procedure switchedArrsOutOfBounds(),start of procedure buggyIter(...),Taking true branch,Taking false branch,return from a call to void ArrayOutOfBounds.buggyIter(int[],int[]),return from a call to void ArrayOutOfBounds.switchedArrsOutOfBounds()]
codetoanalyze/java/infer/ClassCastExceptions.java, int ClassCastExceptions.classCastExceptionImplementsInterface(), 0, java.lang.ClassCastException, [start of procedure classCastExceptionImplementsInterface(),start of procedure AnotherImplementationOfInterface(),return from a call to AnotherImplementationOfInterface.<init>(),start of procedure classCastExceptionImplementsInterfaceCallee(...),Skipping ClassCastException(): unknown method,exception java.lang.ClassCastException,return from a call to int ClassCastExceptions.classCastExceptionImplementsInterfaceCallee(AnotherImplementationOfInterface),exception java.lang.ClassCastException,return from a call to int ClassCastExceptions.classCastExceptionImplementsInterface()] codetoanalyze/java/infer/ClassCastExceptions.java, int ClassCastExceptions.classCastExceptionImplementsInterface(), 0, java.lang.ClassCastException, [start of procedure classCastExceptionImplementsInterface(),start of procedure AnotherImplementationOfInterface(),return from a call to AnotherImplementationOfInterface.<init>(),start of procedure classCastExceptionImplementsInterfaceCallee(...),Skipping ClassCastException(): unknown method,exception java.lang.ClassCastException,return from a call to int ClassCastExceptions.classCastExceptionImplementsInterfaceCallee(AnotherImplementationOfInterface),exception java.lang.ClassCastException,return from a call to int ClassCastExceptions.classCastExceptionImplementsInterface()]
codetoanalyze/java/infer/ClassCastExceptions.java, void ClassCastExceptions.classCastException(), 3, java.lang.ClassCastException, [start of procedure classCastException(),start of procedure SubClassA(),start of procedure SuperClass(),return from a call to SuperClass.<init>(),return from a call to SubClassA.<init>(),Skipping ClassCastException(): unknown method,exception java.lang.ClassCastException,return from a call to void ClassCastExceptions.classCastException()] codetoanalyze/java/infer/ClassCastExceptions.java, void ClassCastExceptions.classCastException(), 3, java.lang.ClassCastException, [start of procedure classCastException(),start of procedure SubClassA(),start of procedure SuperClass(),return from a call to SuperClass.<init>(),return from a call to SubClassA.<init>(),Skipping ClassCastException(): unknown method,exception java.lang.ClassCastException,return from a call to void ClassCastExceptions.classCastException()]
codetoanalyze/java/infer/CloseableAsResourceExample.java, T CloseableAsResourceExample.sourceOfNullWithResourceLeak(), 1, RESOURCE_LEAK, [start of procedure sourceOfNullWithResourceLeak(),start of procedure SomeResource(),return from a call to SomeResource.<init>()]
codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.failToCloseWithCloseQuietly(), 5, RESOURCE_LEAK, [start of procedure failToCloseWithCloseQuietly(),start of procedure SomeResource(),return from a call to SomeResource.<init>(),Taking true branch,start of procedure doSomething(),Taking true branch,start of procedure LocalException(),return from a call to LocalException.<init>(),Taking true branch,exception codetoanalyze.java.infer.LocalException,return from a call to void SomeResource.doSomething()]
codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.leakFoundWhenIndirectlyImplementingCloseable(), 1, RESOURCE_LEAK, [start of procedure leakFoundWhenIndirectlyImplementingCloseable(),start of procedure CloseableAsResourceExample$MyResource(...),return from a call to CloseableAsResourceExample$MyResource.<init>(CloseableAsResourceExample)]
codetoanalyze/java/infer/CloseableAsResourceExample.java, void CloseableAsResourceExample.notClosingCloseable(), 1, RESOURCE_LEAK, [start of procedure notClosingCloseable(),start of procedure SomeResource(),return from a call to SomeResource.<init>()]
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.<init>(),start of procedure Sub(...),start of procedure Wrapper(...),return from a call to Wrapper.<init>(Resource),return from a call to Sub.<init>(Resource),Taking true branch,Taking true branch,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.<init>(),Taking true branch]
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.<init>(),Taking true branch,start of procedure doSomething(),Taking true branch,start of procedure LocalException(),return from a call to LocalException.<init>(),Taking true branch,exception codetoanalyze.java.infer.LocalException,return from a call to void SomeResource.doSomething()]
codetoanalyze/java/infer/NullPointerExceptions.java, String NullPointerExceptions.testSystemGetPropertyArgument(), 1, NULL_DEREFERENCE, [start of procedure testSystemGetPropertyArgument()] codetoanalyze/java/infer/NullPointerExceptions.java, String NullPointerExceptions.testSystemGetPropertyArgument(), 1, NULL_DEREFERENCE, [start of procedure testSystemGetPropertyArgument()]
codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullListFiles(String), 3, java.lang.NullPointerException, [start of procedure nullListFiles(...),Skipping File(...): unknown method,Taking true branch,exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullListFiles(String)] codetoanalyze/java/infer/NullPointerExceptions.java, int NullPointerExceptions.nullListFiles(String), 3, java.lang.NullPointerException, [start of procedure nullListFiles(...),Skipping File(...): unknown method,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.nullPointerException(), 2, java.lang.NullPointerException, [start of procedure nullPointerException(),exception java.lang.NullPointerException,return from a call to int NullPointerExceptions.nullPointerException()]

Loading…
Cancel
Save