commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: [LANG] constants (static final fields) defined using wrapper types (for example, in org.apache.commons.lang.math.NumberUtils)
Date Fri, 18 Oct 2013 16:23:26 GMT
+1; the NumberUtils constants were added by Stephen Colebourne back in 2002
and as such far predated the #valueOf() methods introduced on the primitive
wrapper classes in Java 5, so were really a similar caching mechanism for
values one might expect to be commonly used.  Stephen might have more to
add here. I'd have to be fed individual cases but anyone can use viewvc
annotations to do the research I just did.

Matt


On Fri, Oct 18, 2013 at 10:07 AM, sebb <sebbaz@gmail.com> wrote:

> On 18 October 2013 15:49, Benedikt Ritter <britter@apache.org> wrote:
> > Hello Jens,
> >
> > welcome to the ML. It is good style to prefix emails with the short name
> of
> > the component they are about. So since you have a question about commons
> > lang you should put the [LANG] prefix in the subject line (I've done it
> in
> > this response).
> >
> > Now to your question: TBH I don't really know :-) Can anybody else help?
> > Hen? Matt?
>
> AFAIK, these are just commonly used constant values which are not
> provided by the standard Java classes.
>
> This avoids the overhead of boxing for code that needs Long rather than
> long.
>
> > If your looking for material about binary compatibility, you should read
> > http://wiki.eclipse.org/Evolving_Java-based_APIs It provides a good
> > overview over the topic.
> >
> > Regards,
> > Benedikt
> >
> >
> > 2013/10/15 Jens Dietrich <j.b.dietrich@massey.ac.nz>
> >
> >> Hi,
> >>
> >> I have a quick question regarding the use of constants in Apache
> Commons -
> >> in some classes/interfaces like org.apache.commons.lang.math.NumberUtils
> >> some constants are defined using wrapper types and not primitive types.
> >> What are the reasons for this?
> >>
> >> The background of my question is that I am doing some research on binary
> >> vs source compatibility in Java. One such issue is constant inlining,
> and I
> >> try to find out whether engineers consciously use wrapper types to
> prevent
> >> inlining.
> >>
> >> Cheers, Jens
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: dev-help@commons.apache.org
> >>
> >>
> >
> >
> > --
> > http://people.apache.org/~britter/
> > http://www.systemoutprintln.de/
> > http://twitter.com/BenediktRitter
> > http://github.com/britter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message