Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/pmdPublic

[java] UnusedPrivateMethod false positive: Autoboxing into Number #4625

Closed
Labels
a:false-positivePMD flags a piece of code that is not problematic
Milestone
@enexusde

Description

@enexusde

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);}privatevoidfoo(Numberbar) {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);}privatevoidfoo(Numberbar) {System.out.println(bar);}

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp