Skip to content

Conversation

@maigovannon
Copy link

Description

Creating Java25 doc samples and updating some of the existing ones to Java21.

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only

@maigovannon maigovannon requested review from a team and yoshi-approver as code owners October 28, 2025 06:23
@snippet-bot
Copy link

snippet-bot bot commented Oct 28, 2025

Here is the summary of changes.

You are about to add 7 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: appengine Issues related to the App Engine Admin API API. labels Oct 28, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @maigovannon, 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 significantly enhances the Java documentation samples by introducing new examples for Java 25 across Google App Engine Standard, App Engine Flexible, and Cloud Run. It also includes updates to existing functions samples, migrating them to Java 21, providing developers with up-to-date code examples for leveraging newer Java versions with Google Cloud services.

Highlights

  • New Java 25 Samples Added: This pull request introduces a suite of new documentation samples targeting Java 25 across various Google Cloud platforms. This includes new App Engine Standard samples (Google Analytics integration with both EE11 and EE8, and a basic HelloWorld), an App Engine Flexible Micronaut HelloWorld example, and a Cloud Run Spring Boot HelloWorld sample.
  • Existing Samples Updated to Java 21: Several existing functions samples, specifically functions/helloworld/helloworld/pom.xml and functions/v2/pubsub/pom.xml, have been updated to use Java 21 for their Maven compiler target and source versions.
  • Java Version Inconsistencies Noted: There are some inconsistencies in Java versioning: the flexible/java-25/websocket-jetty sample is located in a Java 25 directory but its pom.xml and app.yaml are configured for Java 17. Additionally, the appengine-java25/helloworld/README.md incorrectly states 'Java 21' while the project's configuration (pom.xml, appengine-web.xml) correctly targets Java 25.
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.

@maigovannon maigovannon assigned ludoch and unassigned Nishi-1412 Oct 28, 2025
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 adds new documentation samples for Java 25 and updates some existing ones. My review focuses on ensuring consistency, correctness, and adherence to best practices across the new and updated samples. I've identified several areas for improvement, including correcting Java versions in configuration files and documentation, fixing broken links, updating security protocols, and resolving dependency issues. Addressing these points will enhance the quality and usability of the new samples.

String trackingId = System.getenv("GA_TRACKING_ID");
URIBuilder builder = new URIBuilder();
builder
.setScheme("http")
Copy link
Contributor

Choose a reason for hiding this comment

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

high

For security, you should use https to communicate with the Google Analytics endpoint.

Suggested change
.setScheme("http")
.setScheme("https")

<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.target>25</maven.compiler.target>
<maven.compiler.source>25</maven.compiler.source>
<spring-boot.version>3.5.6</spring-boot.version>
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The Spring Boot version 3.5.6 does not exist. The latest stable version is 3.2.5. Please use a valid version.

Suggested change
<spring-boot.version>3.5.6</spring-boot.version>
<spring-boot.version>3.2.5</spring-boot.version>

Comment on lines +95 to +118
if (!httpClient.isRunning()) {
try {
httpClient.start();
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
if (!webSocketClient.isRunning()) {
try {
webSocketClient.start();
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
ClientUpgradeRequest request = new ClientUpgradeRequest();
// Attempt connection
Future<Session> future =
webSocketClient.connect(clientSocket, new URI(getWebSocketAddress()), request);
// Wait for Connect
Session session = future.get();
// Send a message
session.getRemote().sendString(message);
// Close session
session.close();
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The try-catch blocks for starting httpClient and webSocketClient are incorrect. The start() method throws Exception, not URISyntaxException. Also, simply printing the stack trace is not good error handling. Since the method signature already throws Exception, you can simplify this by removing the try-catch blocks and letting the exceptions propagate.

  private void sendMessageOverWebSocket(String message) throws Exception {
    if (!httpClient.isRunning()) {
      httpClient.start();
    }
    if (!webSocketClient.isRunning()) {
      webSocketClient.start();
    }
    ClientUpgradeRequest request = new ClientUpgradeRequest();
    // Attempt connection
    Future<Session> future =
        webSocketClient.connect(clientSocket, new URI(getWebSocketAddress()), request);
    // Wait for Connect
    Session session = future.get();
    // Send a message
    session.getRemote().sendString(message);
    // Close session
    session.close();
  }

Comment on lines +18 to +19
operating_system: ubuntu22
runtime_version: 17
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 sample is for Java 25, but the app.yaml specifies runtime_version: 17 and operating_system: ubuntu22. This should be updated to runtime_version: 25 and operating_system: ubuntu24 to match the sample.

  operating_system: ubuntu24
  runtime_version: 25

Comment on lines +107 to +108
holderJsp.setInitParameter("compilerTargetVM", "1.8");
holderJsp.setInitParameter("compilerSourceVM", "1.8");
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The JSP compiler source and target VM versions are hardcoded to 1.8. These should be updated to match the project's Java version (25).

Suggested change
holderJsp.setInitParameter("compilerTargetVM", "1.8");
holderJsp.setInitParameter("compilerSourceVM", "1.8");
holderJsp.setInitParameter("compilerTargetVM", "25");
holderJsp.setInitParameter("compilerSourceVM", "25");

Comment on lines +33 to +37
public void testOnMessage() {
assertEquals(ClientSocket.getReceivedMessages().size(), 0);
socket.onMessage("test");
assertEquals(ClientSocket.getReceivedMessages().size(), 1);
}
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 test modifies the state of a static collection (ClientSocket.messages), which can lead to flaky tests if they are run in parallel or in a specific order. It's a good practice to clean up the state after the test runs, for example, in an @After method.

@gemini-code-assist
Copy link
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

<properties>
<maven.compiler.target>25</maven.compiler.target>
<maven.compiler.source>25</maven.compiler.source>
<appengine.sdk.version>2.0.29</appengine.sdk.version>
Copy link
Contributor

Choose a reason for hiding this comment

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

3.0.1

Copy link
Contributor

@iennae iennae left a comment

Choose a reason for hiding this comment

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

Please break this into multiple PRs with a single sample per PR. This is too big for a single PR to process meaningfully.

Thanks.

@maigovannon maigovannon requested a review from a team as a code owner November 2, 2025 13:05
@maigovannon
Copy link
Author

Please break this into multiple PRs with a single sample per PR. This is too big for a single PR to process meaningfully.

Thanks.

Ack. Created separate PRs:

  1. Kokoro CI changes: feat: adding support for Java25 tests to work properly in CI #10199 - This needs to go in first for the other PRs' checks to work fine.
  2. GAE Standard changes: feat: add GAE Standard samples for Java25 #10195
  3. GAE Flex changes: feat: add GAE Flex samples for Java25 #10196
  4. Cloud Run changes: feat: add Cloud Run samples for Java25 #10198
  5. Functions changes: feat: update functions samples #10197

@maigovannon maigovannon closed this Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: appengine Issues related to the App Engine Admin API API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants