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

fix: do not serialize unnecessary fields #1426

Merged
merged 1 commit into from Sep 15, 2021
Merged

Conversation

thiagotnunes
Copy link
Contributor

@thiagotnunes thiagotnunes commented Sep 15, 2021

Do not serialize java.util.regex.Pattern and executor fields in client side statement. This caused an issue with Java 16 compilation, where an IllegalAccessException is thrown during JSON serialization of such fields.

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.String java.util.regex.Pattern.pattern accessible: module java.base does not "opens java.util.regex" to unnamed module @5fcbae9d
    at java.lang.reflect.AccessibleObject.checkCanSetAccessible (AccessibleObject.java:357)
    at java.lang.reflect.AccessibleObject.checkCanSetAccessible (AccessibleObject.java:297)
    at java.lang.reflect.Field.checkCanSetAccessible (Field.java:177)
    at java.lang.reflect.Field.setAccessible (Field.java:171)
    at com.google.gson.internal.reflect.UnsafeReflectionAccessor.makeAccessible (UnsafeReflectionAccessor.java:44)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields (ReflectiveTypeAdapterFactory.java:159)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create (ReflectiveTypeAdapterFactory.java:102)
    at com.google.gson.Gson.getAdapter (Gson.java:458)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField (ReflectiveTypeAdapterFactory.java:117)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields (ReflectiveTypeAdapterFactory.java:166)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create (ReflectiveTypeAdapterFactory.java:102)
    at com.google.gson.Gson.getAdapter (Gson.java:458)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create (CollectionTypeAdapterFactory.java:53)
    at com.google.gson.Gson.getAdapter (Gson.java:458)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField (ReflectiveTypeAdapterFactory.java:117)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields (ReflectiveTypeAdapterFactory.java:166)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create (ReflectiveTypeAdapterFactory.java:102)
    at com.google.gson.Gson.getAdapter (Gson.java:458)
    at com.google.gson.Gson.fromJson (Gson.java:931)
    at com.google.gson.Gson.fromJson (Gson.java:870)
    at com.google.cloud.spanner.connection.ClientSideStatements.importStatements (ClientSideStatements.java:34)

Do not serialize java.util.regex.Pattern and executor fields in client
side statement. This caused an issue with Java 16 compilation, where an
IllegalAccessException is thrown during JSON serialization of such
fields.
@thiagotnunes thiagotnunes requested a review from as a code owner Sep 15, 2021
@product-auto-label product-auto-label bot added the api: spanner label Sep 15, 2021
@google-cla google-cla bot added the cla: yes label Sep 15, 2021
@thiagotnunes thiagotnunes requested a review from olavloite Sep 15, 2021
@thiagotnunes thiagotnunes merged commit 29209f8 into master Sep 15, 2021
18 checks passed
@thiagotnunes thiagotnunes deleted the java-16-illegal-access-bug branch Sep 15, 2021
KiranmayiB pushed a commit to KiranmayiB/java-spanner that referenced this issue Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants