From c9c7d05ac7a6a84a17754e0aa8dc0663d3a9a230 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 1 Dec 2021 09:05:41 +0100 Subject: [PATCH] [java] UnusedLocalVariable - add test case from #3656 --- .../bestpractices/xml/UnusedLocalVariable.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedLocalVariable.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedLocalVariable.xml index 3ff1770ef1..b6cf9ee65e 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedLocalVariable.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedLocalVariable.xml @@ -391,6 +391,24 @@ public class UnusedLocalVariable { int ignored, unused = 0; int notok = 0; } +} + ]]> + + + + False positive with try-with-resources + 0 +