A RetroSearch Logo

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

Search Query:

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

Autoboxing into Number · Issue #4625 · pmd/pmd · GitHub

Affects PMD Version: pmd:3.19.0:check

Rule: UnusedPrivateMethod

Description:
Calling a private method that accept one parameter of type Number (superclass of autoboxing-type Integer)
Code Sample demonstrating the issue:

		// ...
		foo(2);
	}

	private void foo(Number bar) {
		System.out.println(bar);
	}

Expected outcome:

PMD reports a violation at line 124, but that's wrong. That's a false positive.

Running PMD through: Maven

Workaround:

Cast the parameter to Number will work:

		// ...
		foo((Number) 2);
	}

	private void foo(Number bar) {
		System.out.println(bar);
	}

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