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] FinalFieldCouldBeStatic - false-positive for access of super class field #5018

Open
Wolf2323 opened this issue May 14, 2024 · 0 comments
Labels
a:false-positive PMD flags a piece of code that is not problematic

Comments

@Wolf2323
Copy link

Wolf2323 commented May 14, 2024

Affects PMD Version: 7.1.0

Rule: FinalFieldCouldBeStatic

Description:
Since PMD 7 I have a FinalFieldCouldBeStatic violation, that I can not make final at all as it causes a compiler issue.

Code Sample demonstrating the issue:

It is a bit more complex setup, so I only show parts of it, if you want more or all the code let me know

class JKFlipFlopTests extends FlipFlopTests<JKFlipFlop> {

	@Nested
	class j_k_flip_flop_clock {
		private final JKFlipFlop flipFlop = JKFlipFlopTests.super.flipFlop; // <-- Here is the issue
public abstract class FlipFlopTests<T extends DisruptorBase> {
	protected long tickCount = 1;

	@NotNull
	protected final T flipFlop;

Expected outcome:
This can not be static so there should be no violation

[INFO] PMD Failure: works.reload.relogic.logic.emitter.disruptor.sequential.j_k_flip_flop_clock:60 Rule:FinalFieldCouldBeStatic Priority:3 This final field could be made static.

Running PMD through: Maven

@Wolf2323 Wolf2323 added the a:false-positive PMD flags a piece of code that is not problematic label May 14, 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

1 participant