Skip to content

test(spanner): disable annotation copying on ServerStream mocks causing Java 8 crash#13832

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

test(spanner): disable annotation copying on ServerStream mocks causing Java 8 crash#13832
nnicolee merged 1 commit into
mainfrom
test/disable-spanner-annotations-mock

Conversation

@nnicolee

@nnicolee nnicolee commented Jul 20, 2026

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 PartitionedDmlTransactionTest, two mock declarations for ServerStream were created using the default mock(ServerStream.class) without setting .withoutAnnotations(). Mockito attempts to copy annotations on the mock subclasses, triggering the reflection crash on the JSpecify @NullMarked annotation during Java 8 CI pipelines.

Solution

Replaced mock(ServerStream.class) with mock(ServerStream.class, withSettings().withoutAnnotations()) in testExecuteStreamingPartitionedUpdateRSTstream and testExecuteStreamingPartitionedUpdateGenericInternalException to match the other passing tests. This disables annotation copying on the mocked ServerStream instances and bypasses the Java 8 reflection limitations.

@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 updates PartitionedDmlTransactionTest.java to use withSettings().withoutAnnotations() when mocking ServerStream in three test cases. There are no review comments, so I have no feedback to provide.

@nnicolee
nnicolee marked this pull request as ready for review July 20, 2026 14:35
@nnicolee
nnicolee requested review from a team as code owners July 20, 2026 14:35
@nnicolee
nnicolee merged commit 62c22b7 into main Jul 20, 2026
228 of 229 checks passed
@nnicolee
nnicolee deleted the test/disable-spanner-annotations-mock branch July 20, 2026 15:43
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.

2 participants