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: add reflections configs for generated firestore classes #1419

Merged
merged 2 commits into from Sep 12, 2023

Conversation

mpeddada1
Copy link
Contributor

@mpeddada1 mpeddada1 commented Sep 11, 2023

For tests failing in #1417.
Stacktrace:

  JUnit Vintage:ITSystemTest:testBuildingBundleWhenDocumentDoesNotExist
    MethodSource [className = 'com.google.cloud.firestore.it.ITSystemTest', methodName = 'testBuildingBundleWhenDocumentDoesNotExist', methodParameterTypes = '']
    => java.lang.IllegalStateException: Generated message class "com.google.firestore.bundle.BundleElement" missing method "getMetadata".
       com.google.protobuf.GeneratedMessageV3.getMethodOrDie(GeneratedMessageV3.java:1998)
       com.google.protobuf.GeneratedMessageV3.access$1000(GeneratedMessageV3.java:79)
       com.google.protobuf.GeneratedMessageV3$FieldAccessorTable$SingularFieldAccessor$ReflectionInvoker.<init>(GeneratedMessageV3.java:2347)
       com.google.protobuf.GeneratedMessageV3$FieldAccessorTable$SingularFieldAccessor.<init>(GeneratedMessageV3.java:2418)
       com.google.protobuf.GeneratedMessageV3$FieldAccessorTable$SingularMessageFieldAccessor.<init>(GeneratedMessageV3.java:3105)
       [...]
     Caused by: java.lang.NoSuchMethodException: com.google.firestore.bundle.BundleElement.getMetadata()
       java.base@11.0.19/java.lang.Class.getMethod(DynamicHub.java:2108)
       com.google.protobuf.GeneratedMessageV3.getMethodOrDie(GeneratedMessageV3.java:1995)
       [...]

Using IntelliJ debugger, it can be determined that FirestoreBundle#elementToLengthPrefixedStringBuilder invokes JsonFormat$Printer#print which transitively invokes GeneratedMessagev3#getMethodOrDie that reflectively calls methods in com.google.firestore.bundle.BundleElement, com.google.firestore.bundle.BundleMetadata and so on.

Screenshot 2023-09-11 at 6 32 03 PM

@mpeddada1 mpeddada1 requested review from a team as code owners September 11, 2023 14:21
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: firestore Issues related to the googleapis/java-firestore API. labels Sep 11, 2023
Copy link
Member

@suztomo suztomo left a comment

Choose a reason for hiding this comment

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

As long as the GraalVM test passes, it's good.

@mpeddada1 mpeddada1 merged commit 1c5e09f into main Sep 12, 2023
21 of 22 checks passed
@mpeddada1 mpeddada1 deleted the firestore-reflection branch September 12, 2023 14:19
cherylEnkidu pushed a commit that referenced this pull request Dec 11, 2023
* fix: add reflections configs for generated firestore classes

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/java-firestore API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants