Skip to content

test(bigtable): disable deep stub answers causing Java 8 Mockito reflection crash#13831

Merged
nnicolee merged 1 commit into
mainfrom
test/disable-bigtable-annotations-mock
Jul 20, 2026
Merged

test(bigtable): disable deep stub answers causing Java 8 Mockito reflection crash#13831
nnicolee merged 1 commit into
mainfrom
test/disable-bigtable-annotations-mock

Conversation

@nnicolee

Copy link
Copy Markdown
Contributor

Problem

In JSpecify 1.0.0, the @NullMarked annotation targets ElementType.MODULE. Because ElementType.MODULE was introduced in Java 9, reflecting on @NullMarked classes under Java 8 (JDK 1.8) throws EnumConstantNotPresentExceptionProxy wrapped in an ArrayStoreException.

In BigtableDataClientTests, Mockito's mock declarations for ServerStreamingCallable were configured with answer = Answers.RETURNS_DEEP_STUBS. When Mockito generates deep stubs, it dynamically reflects on the return type to build intermediate mocks, triggering this reflection crash on @NullMarked classes under Java 8 CI pipelines.

Solution

Since the tests do not actually call or rely on deep stubs for these streaming callables, we can safely remove (answer = Answers.RETURNS_DEEP_STUBS). Removing deep stubs prevents Mockito from performing the reflection that causes the Java 8 pipeline crash, allowing the test suite to execute successfully.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request removes the unused org.mockito.Answers import and simplifies several @Mock annotations in BigtableDataClientTests.java by removing the (answer = Answers.RETURNS_DEEP_STUBS) configuration. There are no review comments to address, so no additional feedback is provided.

@nnicolee
nnicolee marked this pull request as ready for review July 20, 2026 14:42
@nnicolee
nnicolee requested review from a team as code owners July 20, 2026 14:42
@nnicolee
nnicolee merged commit 13964f2 into main Jul 20, 2026
212 checks passed
@nnicolee
nnicolee deleted the test/disable-bigtable-annotations-mock branch July 20, 2026 15:24
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.

3 participants