diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md
index b01707eb98..d9f11046c3 100644
--- a/docs/pages/release_notes.md
+++ b/docs/pages/release_notes.md
@@ -24,6 +24,10 @@ This is a {{ site.pmd.release_type }} release.
the builder needs to end with "Builder", e.g. `newBuilder()` or `initBuilder()` works. This change
fixes a couple of false positives.
+* The Java rule {% rule "java/errorprone/DataflowAnomalyAnalysis" %} (`java-errorprone`) doesn't check for
+ UR anomalies (undefined and then referenced) anymore. These checks were all false-positives, since actual
+ UR occurrences would lead to compile errors.
+
### Fixed Issues
* core
@@ -39,6 +43,7 @@ This is a {{ site.pmd.release_type }} release.
* [#1912](https://github.com/pmd/pmd/issues/1912): \[java] Metrics not computed correctly with annotations
* java-errorprone
* [#336](https://github.com/pmd/pmd/issues/336): \[java] InvalidSlf4jMessageFormat applies to log4j2
+ * [#1636](https://github.com/pmd/pmd/issues/1636): \[java] Stop checking UR anomalies for DataflowAnomalyAnalysis
* doc
* [#2058](https://github.com/pmd/pmd/issues/2058): \[doc] CLI reference for `-norulesetcompatibility` shows a boolean default value
@@ -80,6 +85,7 @@ This is a {{ site.pmd.release_type }} release.
* [#2012](https://github.com/pmd/pmd/pull/2012): \[java] Fixes 336, slf4j log4j2 support - [Mark Hall](https://github.com/markhall82)
* [#2032](https://github.com/pmd/pmd/pull/2032): \[core] Allow adding SourceCode directly into CPD - [Nathan Braun](https://github.com/nbraun-Google)
* [#2047](https://github.com/pmd/pmd/pull/2047): \[java] Fix computation of metrics with annotations - [Andi](https://github.com/andipabst)
+* [#2065](https://github.com/pmd/pmd/pull/2065): \[java] Stop checking UR anomalies - [Carlos Macasaet](https://github.com/l0s)
{% endtocmaker %}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/DataflowAnomalyAnalysisRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/DataflowAnomalyAnalysisRule.java
index bd70eddb4e..a229b4bb4d 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/DataflowAnomalyAnalysisRule.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/DataflowAnomalyAnalysisRule.java
@@ -131,8 +131,6 @@ public class DataflowAnomalyAnalysisRule extends AbstractJavaRule implements Exe
if (va.accessTypeMatches(u.accessType) && va.isDefinition()) { // DD
addDaaViolation(rc, lastNode, "DD", va.getVariableName(), startLine, endLine);
- } else if (u.accessType == VariableAccess.UNDEFINITION && va.isReference()) { // UR
- addDaaViolation(rc, lastNode, "UR", va.getVariableName(), startLine, endLine);
} else if (u.accessType == VariableAccess.DEFINITION && va.isUndefinition()) { // DU
addDaaViolation(rc, firstNode, "DU", va.getVariableName(), startLine, endLine);
}
diff --git a/pmd-java/src/main/resources/category/java/errorprone.xml b/pmd-java/src/main/resources/category/java/errorprone.xml
index ae156f63a3..6e99ee509e 100644
--- a/pmd-java/src/main/resources/category/java/errorprone.xml
+++ b/pmd-java/src/main/resources/category/java/errorprone.xml
@@ -1120,9 +1120,8 @@ public class JuniorClass extends SeniorClass {
The dataflow analysis tracks local definitions, undefinitions and references to variables on different paths on the data flow.
From those informations there can be found various problems.
-1. UR - Anomaly: There is a reference to a variable that was not defined before. This is a bug and leads to an error.
-2. DU - Anomaly: A recently defined variable is undefined. These anomalies may appear in normal source text.
-3. DD - Anomaly: A recently defined variable is redefined. This is ominous but don't have to be a bug.
+1. DU - Anomaly: A recently defined variable is undefined. These anomalies may appear in normal source text.
+2. DD - Anomaly: A recently defined variable is redefined. This is ominous but don't have to be a bug.
5
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/DataflowAnomalyAnalysis.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/DataflowAnomalyAnalysis.xml
index 620dfa4bc3..c0674723f1 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/DataflowAnomalyAnalysis.xml
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/DataflowAnomalyAnalysis.xml
@@ -50,7 +50,7 @@ public class Foo {
- 1
+ 0
#1393 PMD hanging during DataflowAnomalyAnalysis
-
- 6
+
+ 3