Context
The change satisfies the request made in #21758 which involves adding support for a suffix to BigInteger
, similar to 'L' for long
.
Usage
The proposed solution makes it possible to use both BigInteger
and BigDecimal
for both HEX and non-HEX number literals.
The suffixes BI
and BD
are used for BigInteger
and BigDecimal
, respectively. Both suffixes can be specified in lower/upper case or mixed.
Solution
Consider please diagram attached.
It shows all the elements that have been changed as part of the solution.
Yellow - represent existing elements.
Green - "big number" (BigInteger
and BigDecimal
) extension of Tokenizer
.
In general, the solution is implemented similarly to the L
support, aiming for as much consistency as possible with the current design.
Whole "big number" related code is isolated in 2 inner classes, one for HEX literal (BigHexIntegerConcernExtension) and another one for non-HEX one (BigNonHexNumberConcernExtension) both having common parent BigNumberConcernExtension
.
BigNumberConcernExtension
keeps all the logic related to suffix detection, extraction, position shifting.
BigHexIntegerConcernExtension
and BigNonHexNumberConcernExtension
are responsible for handling the specifics of token addition.
Comment From: ovmarkushyn
@sbrannen BigNumberConcern is also removed from PR description and diagram.
Comment From: sbrannen
Hi @ovmarkushyn,
In light of https://github.com/spring-projects/spring-framework/issues/21758#issuecomment-1937763112, we are closing this PR as well.
Having said that, we do appreciate the hard work you put into this PR! 👍
Thanks,
Sam