From f9921168f5c02dccf9ba3718009f853e02441b1a Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 2 Oct 2024 11:16:42 +0100 Subject: [PATCH] Mark `AbstractRefCounted#mustIncRef` as `final` (#113761) The overridden `RefCounted` methods on `AbstractRefCounted` are all `final`, but `mustIncRef` uses the default implementation and can still be overridden. For the avoidance of doubt, this commit marks `mustIncRef` as `final`. --- .../java/org/elasticsearch/core/AbstractRefCounted.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/core/src/main/java/org/elasticsearch/core/AbstractRefCounted.java b/libs/core/src/main/java/org/elasticsearch/core/AbstractRefCounted.java index 6580c5d4ec45..ef4184c28225 100644 --- a/libs/core/src/main/java/org/elasticsearch/core/AbstractRefCounted.java +++ b/libs/core/src/main/java/org/elasticsearch/core/AbstractRefCounted.java @@ -46,6 +46,12 @@ public abstract class AbstractRefCounted implements RefCounted { } } + @Override + public final void mustIncRef() { + // making this implementation `final` (to be consistent with every other `RefCounted` method implementation) + RefCounted.super.mustIncRef(); + } + @Override public final boolean tryIncRef() { do {