From c9c9325d1cb8774916a09d7d305b8f3980dba024 Mon Sep 17 00:00:00 2001 From: Luca Cavanna Date: Tue, 20 Feb 2024 16:21:50 +0100 Subject: [PATCH] Make name getter method in Mapper.Builder final FieldAliasMapper used to override it but it would not change any behaviour, it can rather call the existing getter for it. --- .../elasticsearch/index/mapper/FieldAliasMapper.java | 10 ++-------- .../java/org/elasticsearch/index/mapper/Mapper.java | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/index/mapper/FieldAliasMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/FieldAliasMapper.java index 97d1b9368a6c9..8aa29e6317d51 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/FieldAliasMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/FieldAliasMapper.java @@ -138,16 +138,10 @@ public boolean supportsVersion(IndexVersion indexCreatedVersion) { } public static class Builder extends Mapper.Builder { - private String name; private String path; protected Builder(String name) { super(name); - this.name = name; - } - - public String name() { - return this.name; } public Builder path(String path) { @@ -157,8 +151,8 @@ public Builder path(String path) { @Override public FieldAliasMapper build(MapperBuilderContext context) { - String fullName = context.buildFullName(name); - return new FieldAliasMapper(name, fullName, path); + String fullName = context.buildFullName(name()); + return new FieldAliasMapper(name(), fullName, path); } } diff --git a/server/src/main/java/org/elasticsearch/index/mapper/Mapper.java b/server/src/main/java/org/elasticsearch/index/mapper/Mapper.java index cf4025150584f..14a71531c6abb 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/Mapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/Mapper.java @@ -31,7 +31,7 @@ protected Builder(String name) { } // TODO rename this to leafName? - public String name() { + public final String name() { return this.name; }