From 8740e8a11af948091752d4dad1d825a3737cb277 Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Thu, 21 Sep 2017 20:42:24 -0700 Subject: [PATCH] [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 --- infer/src/backend/abs.ml | 2 ++ infer/tests/codetoanalyze/java/tracing/issues.exp | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/infer/src/backend/abs.ml b/infer/src/backend/abs.ml index 3bd0e7574..595adc02c 100644 --- a/infer/src/backend/abs.ml +++ b/infer/src/backend/abs.ml @@ -1312,6 +1312,8 @@ let check_junk ?original_prop pname tenv prop = -> (Config.curr_language_is Config.Java, exn_leak) | Some _, Rignore -> (true, exn_leak) + | Some _, Rfile when Config.tracing + -> (true, exn_leak) | Some _, Rfile -> (false, exn_leak) | Some _, Rlock diff --git a/infer/tests/codetoanalyze/java/tracing/issues.exp b/infer/tests/codetoanalyze/java/tracing/issues.exp index e87c38659..46fe65489 100644 --- a/infer/tests/codetoanalyze/java/tracing/issues.exp +++ b/infer/tests/codetoanalyze/java/tracing/issues.exp @@ -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/ClassCastExceptions.java, int ClassCastExceptions.classCastExceptionImplementsInterface(), 0, java.lang.ClassCastException, [start of procedure classCastExceptionImplementsInterface(),start of procedure AnotherImplementationOfInterface(),return from a call to AnotherImplementationOfInterface.(),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.(),return from a call to SubClassA.(),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.()] -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.(),Taking true branch,start of procedure doSomething(),Taking true branch,start of procedure LocalException(),return from a call to LocalException.(),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.(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.()] -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),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.(),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.(),Taking true branch,start of procedure doSomething(),Taking true branch,start of procedure LocalException(),return from a call to LocalException.(),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, 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()]