From cd91dde3fc73ebf19d1708b651859bbbe353eec4 Mon Sep 17 00:00:00 2001 From: Per Lundberg Date: Tue, 6 Apr 2021 16:24:51 +0300 Subject: [PATCH] RedisURI: improve deprecation notice in withPassword() --- src/main/java/io/lettuce/core/RedisURI.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/lettuce/core/RedisURI.java b/src/main/java/io/lettuce/core/RedisURI.java index 86dc5e7d71..c3803b4fb3 100644 --- a/src/main/java/io/lettuce/core/RedisURI.java +++ b/src/main/java/io/lettuce/core/RedisURI.java @@ -1518,9 +1518,14 @@ public Builder withAuthentication(String username, char[] password) { /** * Configures authentication. * + * This method is deprecated as of Lettuce 6.0. The reason is that {@link String} has a + * strong caching affinity and the JVM cannot easily GC {@code String} instances. Therefore + * we suggest using either {@code char[]} or a custom {@link CharSequence} (e.g. {@link + * StringBuilder} or netty's {@link io.netty.util.AsciiString}). + * * @param password the password * @return the builder - * @deprecated since 6.0. Use {@link #withPassword(CharSequence)} or {@link #withPassword(char[])} avoid String caching. + * @deprecated since 6.0. Use {@link #withPassword(CharSequence)} or {@link #withPassword(char[])} to avoid String caching. */ @Deprecated public Builder withPassword(String password) {