A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/5018 below:

[java] FinalFieldCouldBeStatic false-positive for access of super class field · Issue #5018 · pmd/pmd · GitHub

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4