#1188 False positive in UnusedPrivateField

PMD-5.1.1
closed
None
PMD
3-Major
Bug
2014-08-22
2014-04-17
No

This code:

public enum Operation
{
    LEFT( Action.PRIVATE_MOVE ), RIGHT( Action.PRIVATE_MOVE ), STOP( Action.PRIVATE_STAY );

    private final int action;

    private Operation(final int action)
    {
        this.action = action;
    }

    public int getAction()
    {
        return action;
    }

    private static final class Action
    {
        private static final int PRIVATE_STAY = 0;
        private static final int PRIVATE_MOVE = 1;
    }
}

Generates warnings:
Avoid unused private fields such as 'PRIVATE_STAY'.
Avoid unused private fields such as 'PRIVATE_MOVE'.

I would expect that such warning is not given, because those variables are clearly used in the enum above.

I am using PMD 5.0.5 via Eclipse PMD plugin (4.0.2)

Discussion

  • Andreas Dangel

    Andreas Dangel - 2014-04-25

    Will be fixed with the next PMD release.

     
  • Andreas Dangel

    Andreas Dangel - 2014-04-25
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-Next
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks