It feels like the supplier version is much better to avoid the use case of
building the string in place.

I would also like to centralize all things related directly to sys props in
the SysProp class. This way, you know to look in one place instead of
sometimes here and sometimes there.

Do you think we need both versions of the API?

Gary

On Wed, May 1, 2024, 1:56 PM Bernd Eckenfels <e...@zusammenkunft.net> wrote:

> Hi Gregory,
>
> What’s the idea behind that deprecation? The implementation is robust and
> simple and easy to use. I would guess most user rather want to specify a
> literal fallback than a supplier.
>
> Gruss
> Bernd
>
> ggreg...@apache.org wrote on 1. May 2024 16:07 (GMT +02:00):
>
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > ggregory pushed a commit to branch master
> > in repository https://gitbox.apache.org/repos/asf/commons-lang.git
> >
> > commit 794f8aaf1e5a573a63ba6ca514eeb794bd39d855
> > Author: Gary Gregory <garydgreg...@gmail.com>
> > AuthorDate: Wed May 1 09:12:09 2024 -0400
> >
> >     Deprecate SystemUtils.getUserName(String) in favor of
> >     SystemProperties.getUserName(Supplier)
> > ---
> >  src/changes/changes.xml                                 | 1 +
> >  src/main/java/org/apache/commons/lang3/SystemUtils.java | 3 +++
> >  2 files changed, 4 insertions(+)
> >
> > diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> > index cdd3a0cd0..1d896a999 100644
> > --- a/src/changes/changes.xml
> > +++ b/src/changes/changes.xml
> > @@ -123,6 +123,7 @@ The <action> type attribute can be
> > add,update,fix,remove.
> >      <action                   type="fix" dev="ggregory" due-to="Philipp
> >      Trulson, Gary Gregory">Fix Java version in README.md #1170.</action>
> >      <action                   type="fix" dev="ggregory" due-to="Stephan
> >      Peters, Gary Gregory, Bernd">StringUtils.stripAccents() should
> handle
> >      ligatures, UTF32 math blocks, etc. #1201.</action>
> >      <action issue="LANG-1524" type="fix" dev="ggregory"
> >      due-to="kijong.youn, Aakash Gupta, Gary
> >      Gregory">TypeUtils.toString(Type) StackOverflowError for an inner
> >      class in the inner class parameterized enclosing class
> #657.</action>
> > +    <action                   type="fix" dev="ggregory" due-to="Gary
> > Gregory">Deprecate SystemUtils.getUserName(String) in favor of
> > SystemProperties.getUserName(Supplier).</action>
> >      <!-- UPDATE -->
> >      <action                   type="update" dev="sebb"
> >      due-to="Dependabot">Bump commons-parent from 64 to 69
> #1194.</action>
> >      <action                   type="update" dev="ggregory"
> >      due-to="Dependabot">Bump org.codehaus.mojo:exec-maven-plugin from
> >      3.1.1 to 3.2.0 #1175.</action>
> > diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java
> > b/src/main/java/org/apache/commons/lang3/SystemUtils.java
> > index cbb4721fb..8044fd4b0 100644
> > --- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
> > +++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
> > @@ -17,6 +17,7 @@
> >  package org.apache.commons.lang3;
> >
> >  import java.io.File;
> > +import java.util.function.Supplier;
> >
> >  /**
> >   * Helpers for {@link System}.
> > @@ -2041,7 +2042,9 @@ public class SystemUtils {
> >       * access to the specified system property.
> >       * @see SystemProperties#getUserName()
> >       * @since 3.10
> > +     * @deprecated Use {@link SystemProperties#getUserName(Supplier)}.
> >       */
> > +    @Deprecated
> >      public static String getUserName(final String defaultValue) {
> >          return System.getProperty(SystemProperties.USER_NAME,
> >          defaultValue);
> >      }
> >
> >
>
>
> Gruß
> Bernd
> —
> https://bernd.eckenfels.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

Reply via email to