From 3095b68127eacb6e5e3f1a4fcc0713ea540d44b9 Mon Sep 17 00:00:00 2001 From: jrm Date: Tue, 13 Oct 2015 15:24:02 -0700 Subject: [PATCH] Add a test case with @SuppressWarnings on a Buck project Reviewed By: @jvillard Differential Revision: D2520034 fb-gh-sync-id: 830d504 --- infer/tests/ant_report.json | 5 +++++ .../codetoanalyze/java/infer/NullPointerExceptions.java | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/infer/tests/ant_report.json b/infer/tests/ant_report.json index 3e9b060ff..f06f3a304 100644 --- a/infer/tests/ant_report.json +++ b/infer/tests/ant_report.json @@ -612,5 +612,10 @@ "type": "RESOURCE_LEAK", "procedure": "void WriterLeaks.pipedWriterNotClosedAfterConnect(PipedReader)", "file": "codetoanalyze/java/infer/WriterLeaks.java" + }, + { + "type": "NULL_DEREFERENCE", + "procedure": "void NullPointerExceptions.shouldNotReportNPE()", + "file": "codetoanalyze/java/infer/NullPointerExceptions.java" } ] diff --git a/infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java b/infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java index fb6c5df26..9789765fe 100644 --- a/infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java +++ b/infer/tests/codetoanalyze/java/infer/NullPointerExceptions.java @@ -419,4 +419,10 @@ public class NullPointerExceptions { derefUndefinedCallee().toString(); } + @SuppressWarnings("null") // TODO(#8647398): Add support for @SuppressWarnings with Ant + void shouldNotReportNPE() { + Object o = null; + o.toString(); + } + }