Expecting Integer.valueOf(String) to accept Literal format ...
vitalyd at gmail.com
Sat Apr 9 14:51:01 UTC 2016
I don't think the risk of breaking existing code in such a common API is
worth the slight convenience improvement. If someone is keen on supporting
such things, they can front this API by replacing underscores themselves,
or more generally have something else accept underscores and canonicalize
to what Integer.valueOf expects.
On Saturday, April 9, 2016, Charles Oliver Nutter <headius at headius.com>
> I feel like this is an obvious API gap that should be fixed. If it is a
> valid syntax in javac, it should be a valid syntax in JDK APIs. My first
> impression was that this was an obvious oversight.
> - Charlie (mobile)
> On Apr 9, 2016 21:04, "Christoph Engelbert" <me at noctarius.com
> > Hey Andrew,
> > Not sure it would risk breaking compatibility. It’s fairly easy to
> > it by just replacing underscore before parsing. Do you think of code that
> > is expected to not parse underscore arguments? I think it’s a fair
> > to support underscore based integer representations, even though I never
> > needed it yet, anyhow it makes sense to me to give users the possibility
> > have the same integer representation in, let’s say, properties files.
> > Chris
> > >
> > > On 08/04/16 23:36, kedar mhaswade wrote:
> > >> As library writers however, how would you explain this mismatch?
> > >
> > > Changing valueOf(String) runs the risk of breaking existing Java code,
> > > and Java takes compatibility very seriously. Whether it's worth the
> > > risk is a matter of judgement.
> > >
> > > Andrew.
> > >
Sent from my phone
More information about the core-libs-dev