From bb975e67e154a84b5dd47b5a5b24f853758dc7a5 Mon Sep 17 00:00:00 2001 From: Kui LIU Date: Wed, 11 Oct 2017 11:54:00 +0200 Subject: [PATCH] Fix the problem of instanceof test always return true. This instanceof test will always return true because DataType is the superclass of variable nested's class ResourceComparator. The variable nested is not initialized, it would be better to do a null test rather than an instanceof test. http://findbugs.sourceforge.net/bugDescriptions.html#BC_VACUOUS_INSTANCEOF --- .../apache/tools/ant/types/resources/comparators/Reverse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/types/resources/comparators/Reverse.java b/src/main/org/apache/tools/ant/types/resources/comparators/Reverse.java index c787a7652..5da3ebbef 100644 --- a/src/main/org/apache/tools/ant/types/resources/comparators/Reverse.java +++ b/src/main/org/apache/tools/ant/types/resources/comparators/Reverse.java @@ -81,7 +81,7 @@ public class Reverse extends ResourceComparator { if (isReference()) { super.dieOnCircularReference(stk, p); } else { - if (nested instanceof DataType) { + if (nested != null) { pushAndInvokeCircularReferenceCheck((DataType) nested, stk, p); }