From cdb9281f1f7debc518daeea587e9e4efc9e54db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezgi=20=C3=87i=C3=A7ek?= Date: Fri, 20 Mar 2020 07:04:38 -0700 Subject: [PATCH] [java][tests] Fix/suppress unchecked warnings Summary: `make test` failed in some test directories, because we were getting warnings ``` Foo.java uses unchecked or unsafe operations. ``` This diff fixes or suppresses these warnings. Reviewed By: skcho Differential Revision: D20557572 fbshipit-source-id: 63ecd3dfa --- infer/tests/codetoanalyze/java/impurity/PurityModeled.java | 1 + infer/tests/codetoanalyze/java/performance/ArrayListTest.java | 2 +- infer/tests/codetoanalyze/java/purity/PurityModeled.java | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/infer/tests/codetoanalyze/java/impurity/PurityModeled.java b/infer/tests/codetoanalyze/java/impurity/PurityModeled.java index 81f733689..1142b30bf 100644 --- a/infer/tests/codetoanalyze/java/impurity/PurityModeled.java +++ b/infer/tests/codetoanalyze/java/impurity/PurityModeled.java @@ -131,6 +131,7 @@ class PurityModeled { for (Color c : Color.values()) {} } + @SuppressWarnings("unchecked") void clone_pure(ArrayList list) { ArrayList cloned = (ArrayList) list.clone(); cloned.add(""); // no change the list diff --git a/infer/tests/codetoanalyze/java/performance/ArrayListTest.java b/infer/tests/codetoanalyze/java/performance/ArrayListTest.java index 9d00f1c91..7a198bf72 100644 --- a/infer/tests/codetoanalyze/java/performance/ArrayListTest.java +++ b/infer/tests/codetoanalyze/java/performance/ArrayListTest.java @@ -294,7 +294,7 @@ public class ArrayListTest { } } - ArrayList arr = new ArrayList(); + ArrayList arr = new ArrayList(); void boolean_control_var_linear() { for (int i = 0; i < arr.size(); i++) { diff --git a/infer/tests/codetoanalyze/java/purity/PurityModeled.java b/infer/tests/codetoanalyze/java/purity/PurityModeled.java index ce402e104..989753717 100644 --- a/infer/tests/codetoanalyze/java/purity/PurityModeled.java +++ b/infer/tests/codetoanalyze/java/purity/PurityModeled.java @@ -28,6 +28,7 @@ class PurityModeled { for (Color c : Color.values()) {} } + @SuppressWarnings("unchecked") void clone_pure(ArrayList list) { ArrayList cloned = (ArrayList) list.clone(); cloned.add(""); // no change the list