Skip to content

Commit

Permalink
Remove unused deprecate method in FormatNames (#59949)
Browse files Browse the repository at this point in the history
The method was accidentally added in #59555
Deprecation is being done in DateFormatters and Joda classes in guard pattern style.
  • Loading branch information
pgomulka authored Jul 21, 2020
1 parent 2382c75 commit 2421679
Showing 1 changed file with 0 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

package org.elasticsearch.common.time;

import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.util.LazyInitializable;

import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -117,13 +114,6 @@ public enum FormatNames {
private final String camelCaseName;
private final String snakeCaseName;

// DateFormatters and FormatNames are being used even before the logging is initialized.
// If LogManager.getLogger is called before logging config is loaded
// it results in errors sent to status logger and startup to fail.
// Hence a lazy initialization.
private static final LazyInitializable<DeprecationLogger, RuntimeException> deprecationLogger
= new LazyInitializable(() -> DeprecationLogger.getLogger(FormatNames.class));

FormatNames(String camelCaseName, String snakeCaseName) {
this.camelCaseName = camelCaseName;
this.snakeCaseName = snakeCaseName;
Expand All @@ -150,13 +140,6 @@ public boolean isCamelCase(String format) {
return format.equals(camelCaseName);
}

private void deprecate() {
String msg = "Camel case format name {} is deprecated and will be removed in a future version. " +
"Use snake case name {} instead.";
deprecationLogger.getOrCompute()
.deprecate("camelCaseDateFormat", msg, camelCaseName, snakeCaseName);
}

public String getSnakeCaseName() {
return snakeCaseName;
}
Expand Down

0 comments on commit 2421679

Please sign in to comment.