Skip to content

fix(firestore): rename internal Version class to FirestoreAdminVersion to avoid duplicate class conflict#13397

Open
blakeli0 wants to merge 4 commits into
googleapis:mainfrom
blakeli0:fix-firestore-duplicate-classes
Open

fix(firestore): rename internal Version class to FirestoreAdminVersion to avoid duplicate class conflict#13397
blakeli0 wants to merge 4 commits into
googleapis:mainfrom
blakeli0:fix-firestore-duplicate-classes

Conversation

@blakeli0

@blakeli0 blakeli0 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

bom-content-test failed in the releasing PR of java-cloud-bom due to duplicated class error.
This would result in build-time failures in customer's applications if they have static analysis tools enabled.

As a short term fix, replaced the internal Version class in google-cloud-firestore-admin with FirestoreAdminVersion to avoid the error.

In the long term, we should have static checks in this repo to prevent this from happening.

@blakeli0 blakeli0 requested review from a team as code owners June 8, 2026 21:33

@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 renames the Version class to FirestoreAdminVersion in the google-cloud-firestore-admin module to prevent naming conflicts, and updates owlbot.py to automate this renaming and class replacement. It also fixes a bug in owlbot.py where an assignment was incorrectly written as a comparison. The review feedback suggests improving owlbot.py by explicitly specifying UTF-8 encoding when opening files to ensure cross-platform compatibility, and using the more idiomatic s.replace method instead of manual file operations to update version references.

Comment thread java-firestore/owlbot.py Outdated
Comment thread java-firestore/owlbot.py Outdated
Comment on lines +58 to +65
# Replace Version.VERSION with FirestoreAdminVersion.VERSION in FirestoreAdminStubSettings.java
settings_path = "google-cloud-firestore-admin/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStubSettings.java"
if os.path.exists(settings_path):
with open(settings_path, 'r') as f:
content = f.read()
content = content.replace("Version.VERSION", "FirestoreAdminVersion.VERSION")
with open(settings_path, 'w') as f:
f.write(content)

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.

medium

Using s.replace is more idiomatic for owlbot.py scripts and is more robust as it will automatically apply the replacement to any stub settings files in the package (including any new ones added in the future), rather than hardcoding a single file path.

    # Replace Version.VERSION with FirestoreAdminVersion.VERSION in stub files
    s.replace(
        "google-cloud-firestore-admin/src/main/java/com/google/cloud/firestore/v1/stub/**/*.java",
        "Version.VERSION",
        "FirestoreAdminVersion.VERSION",
    )

@blakeli0 blakeli0 force-pushed the fix-firestore-duplicate-classes branch from 724934e to e749d21 Compare June 8, 2026 21:41
Comment thread java-firestore/owlbot.py Outdated
@blakeli0 blakeli0 requested a review from jinseopkim0 June 8, 2026 22:25
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