Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 3, 2023. It is now read-only.
/java-corePublic archive

Commit6fe52c3

Browse files
authored
fix(java): register test class for reflection to fix native image test (#766)
* fix(java): register test class for reflection to fix native image test
1 parent63edc69 commit6fe52c3

File tree

1 file changed

+14
-4
lines changed
  • native-image-support/src/main/java/com/google/cloud/nativeimage/features/clients

1 file changed

+14
-4
lines changed

‎native-image-support/src/main/java/com/google/cloud/nativeimage/features/clients/SpannerFeature.java‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ final class SpannerFeature implements Feature {
2929

3030
privatestaticfinalStringSPANNER_CLASS ="com.google.spanner.v1.SpannerGrpc";
3131
privatestaticfinalStringSPANNER_TEST_CLASS ="com.google.cloud.spanner.GceTestEnvConfig";
32+
privatestaticfinalStringMOCK_CLASS ="com.google.cloud.spanner.MockDatabaseAdminServiceImpl";
3233
privatestaticfinalStringCLIENT_SIDE_IMPL_CLASS =
3334
"com.google.cloud.spanner.connection.ClientSideStatementImpl";
3435
privatestaticfinalStringCLIENT_SIDE_VALUE_CONVERTER =
@@ -50,10 +51,7 @@ final class SpannerFeature implements Feature {
5051

5152
@Override
5253
publicvoidbeforeAnalysis(BeforeAnalysisAccessaccess) {
53-
Class<?>spannerTestClass =access.findClassByName(SPANNER_TEST_CLASS);
54-
if (spannerTestClass !=null) {
55-
NativeImageUtils.registerConstructorsForReflection(access,SPANNER_TEST_CLASS);
56-
}
54+
registerSpannerTestClasses(access);
5755
if (access.findClassByName(CLIENT_SIDE_IMPL_CLASS) !=null) {
5856
NativeImageUtils.registerClassHierarchyForReflection(access,CLIENT_SIDE_IMPL_CLASS);
5957
}
@@ -103,4 +101,16 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
103101
"\\Qcom/google/cloud/spanner/connection/ITSqlScriptTest_TestQueryOptions.sql\\E");
104102
}
105103
}
104+
105+
privatevoidregisterSpannerTestClasses(BeforeAnalysisAccessaccess) {
106+
Class<?>spannerTestClass =access.findClassByName(SPANNER_TEST_CLASS);
107+
if (spannerTestClass !=null) {
108+
NativeImageUtils.registerConstructorsForReflection(access,SPANNER_TEST_CLASS);
109+
}
110+
Class<?>mockClass =access.findClassByName(MOCK_CLASS);
111+
if (mockClass !=null) {
112+
NativeImageUtils.registerClassForReflection(
113+
access,"com.google.cloud.spanner.MockDatabaseAdminServiceImpl$MockBackup");
114+
}
115+
}
106116
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp