You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2016/05/26 17:13:38 UTC

org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)

The method:

org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)

is unused and undocumented. Can we drop it?

I guess it's already in the 2.6 RC1, which is too bad.

Gary

-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)

Posted by Remko Popma <re...@gmail.com>.
It prevents primitives from being auto-boxed in a Number object. Common usage would be static import of the methods in this class, so the class name is not visible in the code. 

The code then looks like 
logger.debug("...{}", box(3.14));

Which communicates to the reader that we are manually wrapping the primitive into an object instead of auto-boxing. Hence the "box" method name. It's also really short which is important. 

The class name Unbox again is a nice short name that reminds users this class helps prevent auto-boxing. 

It is in the util package but is intended for use by users, so this class should actually not be "considered private".

Sent from my iPhone

> On 2016/05/30, at 3:58, Gary Gregory <ga...@gmail.com> wrote:
> 
> Why is it called Unbox? Seems like a misleading and confusing name when all the methods are called "box"! "Boxer" might be better.
> 
> Gary
> 
>> On Thu, May 26, 2016 at 6:32 PM, Gary Gregory <ga...@gmail.com> wrote:
>> There are no callers of the method within Log4j ATM.
>> 
>> Gary
>> 
>>> On Thu, May 26, 2016 at 6:20 PM, Remko Popma <re...@gmail.com> wrote:
>>> Where is this method used?
>>> It is intended to allow the caller to find out if the specified StringBuilder instance is managed by Unbox. 
>>> 
>>> Sent from my iPhone
>>> 
>>>> On 2016/05/27, at 9:50, Gary Gregory <ga...@gmail.com> wrote:
>>>> 
>>>> Ok, so let's drop it from master. I'm AFK ATM.
>>>> 
>>>> Gary
>>>> 
>>>>> On May 26, 2016 12:26 PM, "Matt Sicker" <bo...@gmail.com> wrote:
>>>>> Most of the classes in that package start with the italicized words Consider this class private.
>>>>> 
>>>>>> On 26 May 2016 at 14:19, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>> On Thu, May 26, 2016 at 11:36 AM, Matt Sicker <bo...@gmail.com> wrote:
>>>>>>> Everything in that util package is log4j-private, so there's no worries about removing things.
>>>>>> 
>>>>>> Ah, yes, now I see:
>>>>>> 
>>>>>> "Internal utility classes for the Log4j 2 API. Note that the use of any classes in this package is not supported. There are no guarantees for binary or logical compatibility in this package."
>>>>>> 
>>>>>> I wonder if we should *bold* some of that text.
>>>>>> 
>>>>>> Gary
>>>>>>  
>>>>>>> 
>>>>>>>> On 26 May 2016 at 12:13, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>>> The method:
>>>>>>>> 
>>>>>>>> org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)
>>>>>>>> 
>>>>>>>> is unused and undocumented. Can we drop it?
>>>>>>>> 
>>>>>>>> I guess it's already in the 2.6 RC1, which is too bad.
>>>>>>>> 
>>>>>>>> Gary
>>>>>>>> 
>>>>>>>> -- 
>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>> JUnit in Action, Second Edition
>>>>>>>> Spring Batch in Action
>>>>>>>> Blog: http://garygregory.wordpress.com 
>>>>>>>> Home: http://garygregory.com/
>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> -- 
>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>> JUnit in Action, Second Edition
>>>>>> Spring Batch in Action
>>>>>> Blog: http://garygregory.wordpress.com 
>>>>>> Home: http://garygregory.com/
>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Matt Sicker <bo...@gmail.com>
>> 
>> 
>> 
>> -- 
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>> Java Persistence with Hibernate, Second Edition
>> JUnit in Action, Second Edition
>> Spring Batch in Action
>> Blog: http://garygregory.wordpress.com 
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
> 
> 
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

Re: org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)

Posted by Gary Gregory <ga...@gmail.com>.
Why is it called Unbox? Seems like a misleading and confusing name when all
the methods are called "box"! "Boxer" might be better.

Gary

On Thu, May 26, 2016 at 6:32 PM, Gary Gregory <ga...@gmail.com>
wrote:

> There are no callers of the method within Log4j ATM.
>
> Gary
>
> On Thu, May 26, 2016 at 6:20 PM, Remko Popma <re...@gmail.com>
> wrote:
>
>> Where is this method used?
>> It is intended to allow the caller to find out if the specified
>> StringBuilder instance is managed by Unbox.
>>
>> Sent from my iPhone
>>
>> On 2016/05/27, at 9:50, Gary Gregory <ga...@gmail.com> wrote:
>>
>> Ok, so let's drop it from master. I'm AFK ATM.
>>
>> Gary
>> On May 26, 2016 12:26 PM, "Matt Sicker" <bo...@gmail.com> wrote:
>>
>>> Most of the classes in that package start with the italicized words *Consider
>>> this class private.*
>>>
>>> On 26 May 2016 at 14:19, Gary Gregory <ga...@gmail.com> wrote:
>>>
>>>> On Thu, May 26, 2016 at 11:36 AM, Matt Sicker <bo...@gmail.com> wrote:
>>>>
>>>>> Everything in that util package is log4j-private, so there's no
>>>>> worries about removing things.
>>>>>
>>>>
>>>> Ah, yes, now I see:
>>>>
>>>> "Internal utility classes for the Log4j 2 API. Note that the use of
>>>> any classes in this package is not supported. There are no guarantees for
>>>> binary or logical compatibility in this package."
>>>>
>>>> I wonder if we should *bold* some of that text.
>>>>
>>>> Gary
>>>>
>>>>
>>>>>
>>>>> On 26 May 2016 at 12:13, Gary Gregory <ga...@gmail.com> wrote:
>>>>>
>>>>>> The method:
>>>>>>
>>>>>> org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)
>>>>>>
>>>>>> is unused and undocumented. Can we drop it?
>>>>>>
>>>>>> I guess it's already in the 2.6 RC1, which is too bad.
>>>>>>
>>>>>> Gary
>>>>>>
>>>>>> --
>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>> <http://www.manning.com/bauer3/>
>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>> Blog: http://garygregory.wordpress.com
>>>>>> Home: http://garygregory.com/
>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Matt Sicker <bo...@gmail.com>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>>
>>>
>>>
>>>
>>> --
>>> Matt Sicker <bo...@gmail.com>
>>>
>>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)

Posted by Gary Gregory <ga...@gmail.com>.
There are no callers of the method within Log4j ATM.

Gary

On Thu, May 26, 2016 at 6:20 PM, Remko Popma <re...@gmail.com> wrote:

> Where is this method used?
> It is intended to allow the caller to find out if the specified
> StringBuilder instance is managed by Unbox.
>
> Sent from my iPhone
>
> On 2016/05/27, at 9:50, Gary Gregory <ga...@gmail.com> wrote:
>
> Ok, so let's drop it from master. I'm AFK ATM.
>
> Gary
> On May 26, 2016 12:26 PM, "Matt Sicker" <bo...@gmail.com> wrote:
>
>> Most of the classes in that package start with the italicized words *Consider
>> this class private.*
>>
>> On 26 May 2016 at 14:19, Gary Gregory <ga...@gmail.com> wrote:
>>
>>> On Thu, May 26, 2016 at 11:36 AM, Matt Sicker <bo...@gmail.com> wrote:
>>>
>>>> Everything in that util package is log4j-private, so there's no worries
>>>> about removing things.
>>>>
>>>
>>> Ah, yes, now I see:
>>>
>>> "Internal utility classes for the Log4j 2 API. Note that the use of any
>>> classes in this package is not supported. There are no guarantees for
>>> binary or logical compatibility in this package."
>>>
>>> I wonder if we should *bold* some of that text.
>>>
>>> Gary
>>>
>>>
>>>>
>>>> On 26 May 2016 at 12:13, Gary Gregory <ga...@gmail.com> wrote:
>>>>
>>>>> The method:
>>>>>
>>>>> org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)
>>>>>
>>>>> is unused and undocumented. Can we drop it?
>>>>>
>>>>> I guess it's already in the 2.6 RC1, which is too bad.
>>>>>
>>>>> Gary
>>>>>
>>>>> --
>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>> Java Persistence with Hibernate, Second Edition
>>>>> <http://www.manning.com/bauer3/>
>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>> Blog: http://garygregory.wordpress.com
>>>>> Home: http://garygregory.com/
>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Matt Sicker <bo...@gmail.com>
>>>>
>>>
>>>
>>>
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> Java Persistence with Hibernate, Second Edition
>>> <http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>>
>>
>>
>>
>> --
>> Matt Sicker <bo...@gmail.com>
>>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)

Posted by Remko Popma <re...@gmail.com>.
Where is this method used?
It is intended to allow the caller to find out if the specified StringBuilder instance is managed by Unbox. 

Sent from my iPhone

> On 2016/05/27, at 9:50, Gary Gregory <ga...@gmail.com> wrote:
> 
> Ok, so let's drop it from master. I'm AFK ATM.
> 
> Gary
> 
>> On May 26, 2016 12:26 PM, "Matt Sicker" <bo...@gmail.com> wrote:
>> Most of the classes in that package start with the italicized words Consider this class private.
>> 
>>> On 26 May 2016 at 14:19, Gary Gregory <ga...@gmail.com> wrote:
>>>> On Thu, May 26, 2016 at 11:36 AM, Matt Sicker <bo...@gmail.com> wrote:
>>>> Everything in that util package is log4j-private, so there's no worries about removing things.
>>> 
>>> Ah, yes, now I see:
>>> 
>>> "Internal utility classes for the Log4j 2 API. Note that the use of any classes in this package is not supported. There are no guarantees for binary or logical compatibility in this package."
>>> 
>>> I wonder if we should *bold* some of that text.
>>> 
>>> Gary
>>>  
>>>> 
>>>>> On 26 May 2016 at 12:13, Gary Gregory <ga...@gmail.com> wrote:
>>>>> The method:
>>>>> 
>>>>> org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)
>>>>> 
>>>>> is unused and undocumented. Can we drop it?
>>>>> 
>>>>> I guess it's already in the 2.6 RC1, which is too bad.
>>>>> 
>>>>> Gary
>>>>> 
>>>>> -- 
>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>>>> Java Persistence with Hibernate, Second Edition
>>>>> JUnit in Action, Second Edition
>>>>> Spring Batch in Action
>>>>> Blog: http://garygregory.wordpress.com 
>>>>> Home: http://garygregory.com/
>>>>> Tweet! http://twitter.com/GaryGregory
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Matt Sicker <bo...@gmail.com>
>>> 
>>> 
>>> 
>>> -- 
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>> Java Persistence with Hibernate, Second Edition
>>> JUnit in Action, Second Edition
>>> Spring Batch in Action
>>> Blog: http://garygregory.wordpress.com 
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>> 
>> 
>> 
>> -- 
>> Matt Sicker <bo...@gmail.com>

Re: org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)

Posted by Gary Gregory <ga...@gmail.com>.
Ok, so let's drop it from master. I'm AFK ATM.

Gary
On May 26, 2016 12:26 PM, "Matt Sicker" <bo...@gmail.com> wrote:

> Most of the classes in that package start with the italicized words *Consider
> this class private.*
>
> On 26 May 2016 at 14:19, Gary Gregory <ga...@gmail.com> wrote:
>
>> On Thu, May 26, 2016 at 11:36 AM, Matt Sicker <bo...@gmail.com> wrote:
>>
>>> Everything in that util package is log4j-private, so there's no worries
>>> about removing things.
>>>
>>
>> Ah, yes, now I see:
>>
>> "Internal utility classes for the Log4j 2 API. Note that the use of any
>> classes in this package is not supported. There are no guarantees for
>> binary or logical compatibility in this package."
>>
>> I wonder if we should *bold* some of that text.
>>
>> Gary
>>
>>
>>>
>>> On 26 May 2016 at 12:13, Gary Gregory <ga...@gmail.com> wrote:
>>>
>>>> The method:
>>>>
>>>> org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)
>>>>
>>>> is unused and undocumented. Can we drop it?
>>>>
>>>> I guess it's already in the 2.6 RC1, which is too bad.
>>>>
>>>> Gary
>>>>
>>>> --
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>>
>>>
>>>
>>>
>>> --
>>> Matt Sicker <bo...@gmail.com>
>>>
>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>

Re: org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)

Posted by Matt Sicker <bo...@gmail.com>.
Most of the classes in that package start with the italicized words *Consider
this class private.*

On 26 May 2016 at 14:19, Gary Gregory <ga...@gmail.com> wrote:

> On Thu, May 26, 2016 at 11:36 AM, Matt Sicker <bo...@gmail.com> wrote:
>
>> Everything in that util package is log4j-private, so there's no worries
>> about removing things.
>>
>
> Ah, yes, now I see:
>
> "Internal utility classes for the Log4j 2 API. Note that the use of any
> classes in this package is not supported. There are no guarantees for
> binary or logical compatibility in this package."
>
> I wonder if we should *bold* some of that text.
>
> Gary
>
>
>>
>> On 26 May 2016 at 12:13, Gary Gregory <ga...@gmail.com> wrote:
>>
>>> The method:
>>>
>>> org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)
>>>
>>> is unused and undocumented. Can we drop it?
>>>
>>> I guess it's already in the 2.6 RC1, which is too bad.
>>>
>>> Gary
>>>
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> Java Persistence with Hibernate, Second Edition
>>> <http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>>
>>
>>
>>
>> --
>> Matt Sicker <bo...@gmail.com>
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
Matt Sicker <bo...@gmail.com>

Re: org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)

Posted by Gary Gregory <ga...@gmail.com>.
On Thu, May 26, 2016 at 11:36 AM, Matt Sicker <bo...@gmail.com> wrote:

> Everything in that util package is log4j-private, so there's no worries
> about removing things.
>

Ah, yes, now I see:

"Internal utility classes for the Log4j 2 API. Note that the use of any
classes in this package is not supported. There are no guarantees for
binary or logical compatibility in this package."

I wonder if we should *bold* some of that text.

Gary


>
> On 26 May 2016 at 12:13, Gary Gregory <ga...@gmail.com> wrote:
>
>> The method:
>>
>> org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)
>>
>> is unused and undocumented. Can we drop it?
>>
>> I guess it's already in the 2.6 RC1, which is too bad.
>>
>> Gary
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)

Posted by Matt Sicker <bo...@gmail.com>.
Everything in that util package is log4j-private, so there's no worries
about removing things.

On 26 May 2016 at 12:13, Gary Gregory <ga...@gmail.com> wrote:

> The method:
>
> org.apache.logging.log4j.util.Unbox.isBoxedPrimitive(StringBuilder)
>
> is unused and undocumented. Can we drop it?
>
> I guess it's already in the 2.6 RC1, which is too bad.
>
> Gary
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
Matt Sicker <bo...@gmail.com>