-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Adding new Doc Samples for Java25 #10193
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
Conversation
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...ne-java25/ee11/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java
Show resolved
Hide resolved
| 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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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();
}| operating_system: ubuntu22 | ||
| runtime_version: 17 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| holderJsp.setInitParameter("compilerTargetVM", "1.8"); | ||
| holderJsp.setInitParameter("compilerSourceVM", "1.8"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
| holderJsp.setInitParameter("compilerTargetVM", "1.8"); | |
| holderJsp.setInitParameter("compilerSourceVM", "1.8"); | |
| holderJsp.setInitParameter("compilerTargetVM", "25"); | |
| holderJsp.setInitParameter("compilerSourceVM", "25"); |
...ne-java25/ee11/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java
Outdated
Show resolved
Hide resolved
| public void testOnMessage() { | ||
| assertEquals(ClientSocket.getReceivedMessages().size(), 0); | ||
| socket.onMessage("test"); | ||
| assertEquals(ClientSocket.getReceivedMessages().size(), 1); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...ne-java25/ee11/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java
Outdated
Show resolved
Hide resolved
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
| <properties> | ||
| <maven.compiler.target>25</maven.compiler.target> | ||
| <maven.compiler.source>25</maven.compiler.source> | ||
| <appengine.sdk.version>2.0.29</appengine.sdk.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.0.1
There was a problem hiding this 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.
Ack. Created separate PRs:
|
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
pom.xmlparent set to latestshared-configurationmvn clean verifyrequiredmvn -P lint checkstyle:checkrequiredmvn -P lint clean compile pmd:cpd-check spotbugs:checkadvisory only