[java] FinalFieldCouldBeStatic - false-positive for access of super class field
Wolf2323 opened this issue · comments
Wolf2323 commented
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