Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Java 9 BigInteger constructors #9953

Merged
merged 4 commits into from
Jun 3, 2024
Merged

Conversation

vegegoku
Copy link
Contributor

@vegegoku vegegoku commented May 5, 2024

Emulate the BigInteger(byte[] bytes, int offset, int length) and BigInteger​(int signum, byte[] magnitude, int offset, int length) constructors that were added in java 9.

Fixes #9901

Copy link
Contributor

@niloc132 niloc132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In more closely looking at the Javadoc for BigInteger, I see there is another new constructor:
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigInteger.html#%3Cinit%3E(int,byte%5B%5D,int,int)

There are also other new methods (sqrt, sqrtAndRemainder), and a new constant TWO. I'll make another issue for these new members, but as long as the other constructor is similar work, it seems worth adding now?

@niloc132 niloc132 added this to the 2.12 milestone May 11, 2024
@vegegoku vegegoku requested a review from niloc132 May 19, 2024 16:41
having a byte[] with zero length is allowed for constructor BigInteger(int signum, byte[] val, int offset, int length)
Copy link
Contributor

@niloc132 niloc132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user/super/com/google/gwt/emul/java/math/BigInteger.java Outdated Show resolved Hide resolved
user/super/com/google/gwt/emul/java/math/BigInteger.java Outdated Show resolved Hide resolved
@vegegoku vegegoku requested a review from niloc132 May 26, 2024 09:43
@niloc132 niloc132 changed the title add bigInteger constructor BigInteger(byte[], int offset, int length) Add Java 9 BigInteger constructors Jun 1, 2024
@niloc132 niloc132 merged commit 6cf9146 into gwtproject:main Jun 3, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java 9 BigInteger constructors with offset/length params missing
2 participants