A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/2716 below:

False positive with Enums · Issue #2716 · pmd/pmd · GitHub

Affects PMD Version:
6.26.0
Rule:
CompareObjectsWithEquals

Description:
With #885 this rule was fixed to not show a false-positive violation when comparing enums with '=='.
However there is still a way to get a false-positive.

Code Sample demonstrating the issue:

public class EnumTest {
	enum Type {
		A, B;
	}
	
	private final Type type = Type.A;
	
	public String isTypeA(Type param) {
		return param == type ? "Yes" : "No";
	}
}

Expected outcome:
No violation -> false-positive

Running PMD through: Eclipse


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4