Skip to content

Conversation

@blakeli0
Copy link
Contributor

@blakeli0 blakeli0 commented Jan 2, 2026

No description provided.

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Jan 2, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @blakeli0, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of the test suite by introducing a configurable copyright year for generated code. By allowing the copyright year to be set via an environment variable, particularly for tests, it ensures that test outcomes remain consistent and independent of the actual calendar year, thereby preventing potential test failures caused by year transitions.

Highlights

  • Test Stability Improvement: Introduced a mechanism to fix the copyright year used in generated code during testing, which prevents tests from failing due to year changes.
  • Configurable Copyright Year: The copyright year can now be overridden for testing purposes using the test_current_year environment variable.
  • Maven Surefire Plugin Configuration: The pom.xml was updated to set the test_current_year environment variable to 2025 specifically for test execution.
  • Dynamic Year Retrieval: A new getCurrentYear() helper method was added to CommentComposer.java to dynamically determine the copyright year, prioritizing the environment variable over the system's current year.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 introduces a mechanism to use a fixed copyright year for tests by using an environment variable. The changes in pom.xml set this environment variable for the test execution, and CommentComposer.java is updated to read this variable. This is a good approach for making tests deterministic.

I've added one comment with a suggestion to refactor the new getCurrentYear method to improve maintainability by extracting the magic string into a constant and to use the modern java.time API instead of Calendar.

Comment on lines 85 to 87
String testCurrentYear = System.getenv("test_current_year");
int currentYearFromCalendar = Calendar.getInstance().get(Calendar.YEAR);
return Strings.isNullOrEmpty(testCurrentYear) ? String.valueOf(currentYearFromCalendar) : testCurrentYear;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This method can be improved:

  1. The magic string "test_current_year" on line 85 should be extracted into a private static final constant to improve maintainability.
  2. Since the project uses Java 8, it's better to use the modern java.time API. Calendar.getInstance().get(Calendar.YEAR) can be replaced with java.time.Year.now().getValue(). This would also allow removing the java.util.Calendar import.
    String testCurrentYear = System.getenv("test_current_year");
    return Strings.isNullOrEmpty(testCurrentYear)
        ? String.valueOf(java.time.Year.now().getValue())
        : testCurrentYear;

@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Jan 2, 2026
@blakeli0 blakeli0 changed the title tests: Used fixed copyright year in tests. tests: Use fixed copyright year in tests. Jan 2, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 3, 2026

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
75.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 3, 2026

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants