fix(bqjdbc): fix BigDecimal usage in mocks#13207
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request replaces mocked BigDecimal instances with concrete BigDecimal values in several test cases within BigQueryCallableStatementTest.java, specifically in methods testing parameter retrieval and setting by index and name. I have no feedback to provide.
logachev
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ci / split-units (java-bigquery, 25)check in all JDBC PRs suddenly started failing.Root Cause Analysis
1. JDK 25 Class Layout Restructuring
OpenJDK 25 restructured the internal layouts and private fields of core classes—including
java.math.BigDecimalandjava.math.BigInteger—to lay the groundwork for Project Valhalla's value types and flat objects.2. Bytecode Compatibility Break
Mockito’s final-class mocking relies on the ByteBuddy agent (v1.12.19 in this module) to instrument core JDK classes at runtime. Under JDK 25, the restructured bytecode layouts collided with ByteBuddy's instrumentation patterns. This corrupted internal math helper methods (such as
needIncrement()anddivideAndRound()), causing subsequent standardBigDecimaloperations across the JVM lifecycle to compute incorrect values and trigger theRounding necessaryexception.3. Strict Module Encapsulation
JDK 25 strictly enforces strong encapsulation of the
java.basemodule. Dynamic runtime bytecode manipulation of core JDK classes is increasingly unstable without explicit compatibility updates to agents.Resolution
By replacing
mock(BigDecimal.class)with a concretenew BigDecimal("123.456")instance in BigQueryCallableStatementTest.java, we completely bypass runtime bytecode manipulation, ensuring cross-version compatibility from JDK 11 through JDK 25+.