Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] UnnecessaryFullyQualifiedName fails to recognize illegal self reference in enums #4631

Closed
Adam- opened this issue Jul 12, 2023 · 1 comment
Labels
a:false-positive PMD flags a piece of code that is not problematic
Milestone

Comments

@Adam-
Copy link

Adam- commented Jul 12, 2023

Affects PMD Version: 6.44.0

Rule: UnnecessaryFullyQualifiedName

Description:

UnnecessaryFullyQualifiedName fails to recognize illegal self reference with enum constructors

Code Sample demonstrating the issue:

https://github.com/runelite/runelite/blob/36979d67f7a0ba420ec3ed3189ac27ff3c1a1abb/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Tree.java#L53

import api.ObjectID;
import static api.ObjectID.*;

public enum {
  TEAK_TREE(Duration.of(15, GAME_TICKS), ObjectID.TEAK_TREE, TEAK_TREE_36686, TEAK_TREE_40758),

This errors because there is a wildcard import above import static net.runelite.api.ObjectID.*;, however removing ObjectID. causes an illegal self-reference to the enum.

Expected outcome:

PMD doesn't report this as an error.

Running PMD through: maven

@Adam- Adam- added the a:false-positive PMD flags a piece of code that is not problematic label Jul 12, 2023
@jsotuyod
Copy link
Member

I think this is a duplicate of #1790 which has already been fixed in PMD 7. This should be rechecked with PMD 7.0.0-rc3 to validate.

@adangel adangel added this to the 7.0.0 milestone Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:false-positive PMD flags a piece of code that is not problematic
Projects
None yet
Development

No branches or pull requests

3 participants