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

Java17 as a minimum version #10937

Merged
merged 11 commits into from
Oct 20, 2024
Merged

Java17 as a minimum version #10937

merged 11 commits into from
Oct 20, 2024

Conversation

arysin
Copy link
Contributor

@arysin arysin commented Oct 16, 2024

Summary by CodeRabbit

  • New Features

    • Introduced an AsyncService interface in multiple gRPC service classes for better structure and maintainability.
    • Updated the distributionUrl in the Gradle wrapper to point to Gradle version 8.10.2 for enhanced build performance.
  • Bug Fixes

    • Various dependencies have been updated to their latest versions, ensuring better stability and security.
  • Documentation

    • Added SPDX license identifiers to Gradle scripts for improved licensing clarity.
  • Chores

    • Updated CircleCI configuration to utilize OpenJDK 17 for improved build performance.

Copy link
Contributor

coderabbitai bot commented Oct 16, 2024

Walkthrough

The pull request introduces significant updates to the gRPC service classes, primarily driven by an upgrade of the gRPC proto compiler from version 1.50.2 to 1.68.0. Key changes include the addition of an AsyncService interface, which provides default method implementations for various service operations, enhancing the separation between service interfaces and their implementations. The service binding processes have been streamlined, and several constructors and methods related to handling unknown fields have been removed for consistency. Additionally, the gradle-wrapper.properties and Gradle scripts have been updated to reflect changes in Gradle version and licensing.

Changes

File(s) Change Summary
languagetool-core/src/main/java/org/languagetool/grpc/SynthesizeServerGrpc.java, languagetool-core/src/main/java/org/languagetool/grpc/Synthesizer.java, languagetool-core/src/main/java/org/languagetool/languagemodel/bert/grpc/BertLmGrpc.java, languagetool-core/src/main/java/org/languagetool/languagemodel/bert/grpc/BertLmProto.java, languagetool-core/src/main/java/org/languagetool/rules/ml/MLServerGrpc.java, languagetool-core/src/main/java/org/languagetool/rules/ml/PostProcessingServerGrpc.java, languagetool-core/src/main/java/org/languagetool/rules/ml/ProcessingServerGrpc.java Introduced AsyncService interface in multiple gRPC service classes; updated methods to default implementations; refactored service binding process. Removed handling of unknown fields in Synthesizer.
languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradle/wrapper/gradle-wrapper.properties Updated distributionUrl from Gradle version 8.4 to 8.10.2.
languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradlew Added SPDX license identifier; updated command for resolving current directory.
languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradlew.bat Added SPDX license identifier; updated error handling to redirect error messages to standard error output.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
languagetool-core/pom.xml (1)

JDK 8 Configurations Still Present and Need Cleanup

Several JDK 8 specific configurations and APIs are still present in the codebase:

  • pom.xml Files:

    • <classifier>jdk8</classifier>
    • <require>java >= 1.8.0</require>
    • <id>jdk8</id>
  • Java Files:

    • Usage of Optional, Stream.of, CompletableFuture, and LocalDateTime.

Action Items:

  1. Remove JDK 8 Specific Configurations:

    • Eliminate all <classifier>jdk8</classifier>, <require>java >= 1.8.0</require>, and <id>jdk8</id> entries from all pom.xml files.
  2. Verify Java API Usage:

    • Ensure that the usage of Java 8 APIs like Optional, Stream.of, CompletableFuture, and LocalDateTime aligns with Java 17 standards and does not introduce compatibility issues.
  3. Consistency Across Modules:

    • Confirm that all modules within the project have uniformly updated their configurations to exclude JDK 8 references.
  4. Update Documentation:

    • Reflect the removal of JDK 8 support in the project documentation, specifying Java 17 as the new minimum requirement.
🔗 Analysis chain

Line range hint 318-333: Confirm intention to drop JDK 8 support and clean up commented code

The JDK 8 profile has been commented out, which aligns with the PR objective of setting Java 17 as the minimum version. To maintain code cleanliness and prevent confusion:

  1. If JDK 8 support is indeed being dropped, consider removing this commented-out profile entirely rather than leaving it as a comment.
  2. Ensure that this change is consistent across all modules and that there are no remaining JDK 8 specific configurations.
  3. Update the project documentation to clearly state the new minimum JDK requirement (Java 17).

To ensure consistency across the project, run the following script:

This script will help identify any remaining JDK 8 specific configurations or Java 8 specific APIs that might need attention during this upgrade.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining JDK 8 specific configurations

# Search for JDK 8 related configurations in pom.xml files
echo "Searching for JDK 8 related configurations in pom.xml files:"
rg --type xml "(jdk8|1\.8)" -g "pom.xml"

# Search for Java 8 specific syntax or APIs in Java files
echo "Searching for Java 8 specific syntax or APIs in Java files:"
rg "\b(Stream\.of|CompletableFuture|Optional|LocalDateTime)\b" --type java

Length of output: 1736


Script:

#!/bin/bash
# Description: Check for any remaining JDK 8 specific configurations and Java 8 specific APIs

# Search for JDK 8 related configurations in pom.xml files
echo "Searching for JDK 8 related configurations in pom.xml files:"
rg --type xml "(jdk8|1\.8)" -g "pom.xml"

# Search for Java 8 specific syntax or APIs in Java files
echo "Searching for Java 8 specific syntax or APIs in Java files:"
rg "\b(Stream\.of|CompletableFuture|Optional|LocalDateTime)\b" --type java

Length of output: 16453

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8dc667f and 79c7975.

📒 Files selected for processing (4)
  • languagetool-client-example/pom.xml (1 hunks)
  • languagetool-core/pom.xml (2 hunks)
  • languagetool-server/pom.xml (1 hunks)
  • pom.xml (5 hunks)
✅ Files skipped from review due to trivial changes (1)
  • languagetool-server/pom.xml
🧰 Additional context used
🔇 Additional comments (9)
languagetool-client-example/pom.xml (2)

18-19: Approved: Java compiler version update to 17

This change aligns with the PR objective of setting "Java17 as a minimum version". Updating to Java 17 brings numerous improvements and new features.

To ensure smooth transition, please verify:

  1. All dependencies are compatible with Java 17.
  2. The rest of the codebase doesn't use any deprecated features removed in Java 17.
  3. CI/CD pipelines are updated to use Java 17.

Run the following script to check for potential compatibility issues:


27-27: Approved with comments: Update of language-all dependency to version 6.5

The update from version 5.9 to 6.5 is a significant jump that might introduce breaking changes or new features.

Please provide the following information:

  1. Reason for this specific version update.
  2. Summary of major changes between 5.9 and 6.5 versions.
  3. Confirmation that this version is compatible with Java 17.

To verify the impact of this update, run the following script:

languagetool-core/pom.xml (3)

Line range hint 1-362: Summary of pom.xml changes

The changes in this file align with the PR objective of setting Java 17 as the minimum version. Here's a summary of the main points:

  1. The JDK 8 profile has been commented out, effectively dropping support for Java 8.
  2. The JDK 17 profile is retained but could benefit from a more specific activation range.
  3. The protoc profile remains unchanged, but its compatibility with Java 17 should be verified.

To ensure a smooth transition to Java 17 as the minimum version, please address the following:

  1. Remove the commented-out JDK 8 profile entirely if it's no longer needed.
  2. Update project documentation to clearly state the new minimum JDK requirement.
  3. Consider narrowing the JDK 17 profile activation range to [17,).
  4. Verify the compatibility of protoc and gRPC versions with Java 17.
  5. Ensure consistency of these changes across all modules in the project.

Line range hint 334-362: Verify protoc profile compatibility and configuration

The protoc profile remains unchanged, which is good for consistency. However, consider the following points:

  1. Verify that the specified versions of protoc and gRPC (${protoc.version}, ${io.grpc.version}) are compatible with Java 17.
  2. The current configuration prevents clearing the output directory (<clearOutputDirectory>false</clearOutputDirectory>). While this is good for preserving existing source files, it could potentially lead to stale generated files. Consider adding a comment explaining this choice.
  3. Ensure that the version properties (${protoc.version}, ${io.grpc.version}) are properly defined in this POM or the parent POM.

To check the compatibility and property definitions, run the following script:

#!/bin/bash
# Description: Check protoc and gRPC versions, and verify property definitions

# Extract protoc and gRPC versions from the root pom.xml
echo "Extracting protoc and gRPC versions from root pom.xml:"
rg --type xml "<protoc\.version>(.*)</protoc\.version>" -g "pom.xml" -r '$1' --no-filename
rg --type xml "<io\.grpc\.version>(.*)</io\.grpc\.version>" -g "pom.xml" -r '$1' --no-filename

# Check if these versions are listed as compatible with Java 17 in their respective documentation
echo "Please manually verify the compatibility of these versions with Java 17 in their documentation."

# Search for the usage of these properties in the project
echo "Searching for usage of protoc.version and io.grpc.version properties:"
rg --type xml "\${protoc\.version}" -g "pom.xml"
rg --type xml "\${io\.grpc\.version}" -g "pom.xml"

This script will help you verify the versions being used and their compatibility with Java 17.


Line range hint 301-313: Consider adjusting JDK 17 profile activation range

The JDK 17 profile is currently activated for JDK versions 11 and above. Given that the PR objective is to set Java 17 as the minimum version:

  1. Consider narrowing the activation range to JDK 17 and above. This can be done by changing <jdk>[11,)</jdk> to <jdk>[17,)</jdk>.
  2. Confirm that the git-commit-id-maven-plugin is the correct plugin to use for all supported Java versions, as it differs from the git-commit-id-plugin used in the commented-out JDK 8 profile.

To ensure the correct plugin usage across the project, run the following script:

#!/bin/bash
# Description: Check for git-commit-id plugin usage across the project

# Search for git-commit-id plugin configurations in pom.xml files
echo "Searching for git-commit-id plugin configurations in pom.xml files:"
rg --type xml "(git-commit-id-maven-plugin|git-commit-id-plugin)" -g "pom.xml"

This will help identify any inconsistencies in the usage of git-commit-id plugins across different profiles or modules.

pom.xml (4)

Line range hint 1269-1307: Updated git-commit-id-plugin configuration for Java 17

The configuration for the git-commit-id-plugin has been updated to use a newer version (5.0.0) for Java 17, while maintaining a separate configuration (4.0.0) for Java 8 compatibility. This change ensures that the plugin works correctly with both Java versions.

To ensure this change doesn't introduce any issues, please run the following verification:

#!/bin/bash
# Description: Verify git-commit-id-plugin functionality

# Test: Check if git.properties file is generated correctly
echo "Building the project and checking for git.properties:"
mvn clean package
find . -name git.properties -type f -exec echo "git.properties found at: {}" \; -exec cat {} \;

Line range hint 1-1495: Summary of changes and potential impact

This PR introduces several significant changes to the project:

  1. Upgrade to Java 17 from Java 8
  2. Multiple dependency version updates
  3. Plugin configuration changes, particularly for git-commit-id-plugin
  4. Modification of the HSQLDB dependency configuration

These changes collectively modernize the project and potentially improve security and performance. However, they also introduce risks of compatibility issues and breaking changes.

To ensure a smooth transition and minimize potential issues, please:

  1. Thoroughly test the entire application, paying special attention to areas affected by major dependency updates.
  2. Review and update any Java 8-specific code to ensure compatibility with Java 17.
  3. Verify that all plugins and build processes work correctly with the new configurations.
  4. Update project documentation to reflect the new Java version requirement and any other relevant changes.

Run the following command to perform a full build and test cycle:

#!/bin/bash
# Description: Perform a full build and test cycle

echo "Running full build and test cycle:"
mvn clean install

echo "Checking for any errors or warnings in the build log:"
mvn clean install | grep -E "ERROR|WARNING"

If all tests pass and no significant issues are found, this PR can be considered ready for merging.


Line range hint 149-240: Multiple dependency updates - Ensure compatibility and test thoroughly

Several dependencies have been updated to newer versions. Notable updates include:

  1. Apache Commons Compress: 1.26.0 -> 1.27.1
  2. gRPC: 1.66.0 -> 1.68.0
  3. MariaDB Java Client: 2.7.6 -> 3.4.1
  4. Bcrypt: 0.6.0 -> 0.10.2
  5. Logback: 1.3.14 -> 1.5.8
  6. Jackson: 2.15.0 -> 2.18.0
  7. Lombok: 1.18.26 -> 1.18.34

While these updates are beneficial for security and performance, they may introduce breaking changes or require code modifications.

Please ensure thorough testing of the application, especially focusing on areas that heavily use these updated dependencies. Run the following commands to check for potential issues:

#!/bin/bash
# Description: Verify dependency updates and their impact

# Test: Check for any compile errors after dependency updates
echo "Compiling the project to check for any errors:"
mvn clean compile

# Test: Run all tests to ensure nothing breaks with new dependency versions
echo "Running all tests:"
mvn test

# Test: Check for any deprecated method usage from updated dependencies
echo "Checking for deprecated method usage:"
rg --type java -i "(?:@Deprecated|@SuppressWarnings\(\"deprecation\"\))"

115-116: Significant update to Java 17 - Verify compatibility and take advantage of new features

The project has been updated to use Java 17, which is a major version jump from Java 8. This change allows the use of newer Java features and improvements, potentially enhancing performance and developer productivity.

However, this update may introduce compatibility issues with existing code or dependencies that are not Java 17 compatible.

To ensure a smooth transition, please run the following verification steps:

pom.xml Outdated
Comment on lines 1201 to 1203
<!--
<classifier>jdk8</classifier>
-->
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

HSQLDB dependency configuration change

The HSQLDB dependency configuration has been modified by commenting out the jdk8 classifier. This change might affect how the HSQLDB dependency is resolved and used in the project.

Please verify if this change is intentional and doesn't break any existing functionality. Consider the following actions:

  1. If the change is intentional, update the comment to explain why the classifier is no longer needed.
  2. If the change is unintentional, revert it by uncommenting the classifier.
<dependency>
    <groupId>org.hsqldb</groupId>
    <artifactId>hsqldb</artifactId>
    <version>${hsqldb.version}</version>
-    <!--
-    <classifier>jdk8</classifier>
-    -->
+    <classifier>jdk8</classifier>
    <scope>test</scope>
</dependency>

Committable suggestion was skipped due to low confidence.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (5)
languagetool-core/src/main/java/org/languagetool/rules/ml/PostProcessingServerGrpc.java (2)

18-18: Consider using String instead of java.lang.String

The SERVICE_NAME constant is declared using the fully qualified class name java.lang.String. In Java, it is standard practice to use the unqualified String unless there is a naming conflict. Using String improves readability.

Apply this diff to simplify the declaration:

-public static final java.lang.String SERVICE_NAME = "lt_ml_server.PostProcessingServer";
+public static final String SERVICE_NAME = "lt_ml_server.PostProcessingServer";

282-284: Consider using String instead of java.lang.String

The methodName field and constructor parameter use the fully qualified java.lang.String type. For clarity and consistency, it's recommended to use String.

Apply this diff to simplify the declarations:

-private final java.lang.String methodName;
+private final String methodName;

-PostProcessingServerMethodDescriptorSupplier(java.lang.String methodName) {
+PostProcessingServerMethodDescriptorSupplier(String methodName) {
languagetool-core/src/main/java/org/languagetool/rules/ml/MLServerGrpc.java (1)

15-15: Simplify the type declaration for SERVICE_NAME

Specifying java.lang.String is unnecessary because types from java.lang are implicitly imported. Consider simplifying the declaration for clarity.

Apply this diff to simplify the type:

-public static final java.lang.String SERVICE_NAME = "lt_ml_server.MLServer";
+public static final String SERVICE_NAME = "lt_ml_server.MLServer";
languagetool-core/src/main/java/org/languagetool/languagemodel/bert/grpc/BertLmProto.java (2)

97-97: Explicitly initializing start_ to zero

Setting start_ to zero is redundant since instance variables are zero-initialized by default in Java. While it improves readability, consider whether this explicit initialization is necessary.


108-108: Explicitly initializing end_ to zero

Similar to start_, explicitly initializing end_ to zero is redundant. Evaluate if this explicit initialization aligns with the project's coding conventions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between db14d91 and 2e70738.

📒 Files selected for processing (8)
  • languagetool-core/src/main/java/org/languagetool/grpc/SynthesizeServerGrpc.java (7 hunks)
  • languagetool-core/src/main/java/org/languagetool/grpc/Synthesizer.java (79 hunks)
  • languagetool-core/src/main/java/org/languagetool/languagemodel/bert/grpc/BertLmGrpc.java (7 hunks)
  • languagetool-core/src/main/java/org/languagetool/languagemodel/bert/grpc/BertLmProto.java (93 hunks)
  • languagetool-core/src/main/java/org/languagetool/rules/ml/MLServerGrpc.java (7 hunks)
  • languagetool-core/src/main/java/org/languagetool/rules/ml/PostProcessingServerGrpc.java (7 hunks)
  • languagetool-core/src/main/java/org/languagetool/rules/ml/ProcessingServerGrpc.java (7 hunks)
  • pom.xml (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pom.xml
🧰 Additional context used
🔇 Additional comments (42)
languagetool-core/src/main/java/org/languagetool/grpc/SynthesizeServerGrpc.java (5)

8-8: Updated gRPC proto compiler to version 1.68.0

The file has been regenerated using gRPC proto compiler version 1.68.0, which is a significant jump from the previous version. Ensure that this update is compatible with other dependencies and does not introduce any unexpected issues.


95-103: Introduction of AsyncService interface enhances modularity

The addition of the AsyncService interface encapsulates the synthesize method, promoting better separation of concerns and improving code maintainability.


108-112: SynthesizeServerImplBase now implements AsyncService

By having SynthesizeServerImplBase implement AsyncService, the class now benefits from default method implementations and aligns with the updated gRPC server patterns.


229-240: Addition of bindService method aligns with updated gRPC practices

The new static bindService method simplifies the binding of the service to the gRPC server, adhering to the latest gRPC code generation standards.


15-15: Verify the consistency of SERVICE_NAME with the protobuf definition

The SERVICE_NAME is set to "lt_ml_server.SynthesizeServer". Please confirm that this matches the service name defined in your synthesizer.proto file to prevent any potential mismatches.

You can run the following script to check the service name in the protobuf file:

✅ Verification successful

SERVICE_NAME is consistent with the protobuf definition.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the SERVICE_NAME matches the service name in synthesizer.proto

# Find the synthesizer.proto file
PROTO_FILE=$(fd --type f --extension proto "synthesizer.proto")

# Check if the service name matches
echo "Expected service name: SynthesizeServer"
echo "Actual service name in proto file:"
grep -E 'service\s+SynthesizeServer' ${PROTO_FILE}

Length of output: 399


Script:

#!/bin/bash
# Description: Extract the package name from synthesizer.proto to verify consistency with SERVICE_NAME

# Find the synthesizer.proto file
PROTO_FILE=$(fd --type f --extension proto "synthesizer.proto")

# Extract the package name
echo "Expected package name: lt_ml_server"
echo "Actual package name in proto file:"
grep -E '^package\s+' ${PROTO_FILE}

Length of output: 371

languagetool-core/src/main/java/org/languagetool/rules/ml/PostProcessingServerGrpc.java (9)

117-118: Update of PostProcessingServerImplBase to implement AsyncService

The PostProcessingServerImplBase class now implements the AsyncService interface, aligning with the updated design and promoting consistency.


121-121: Update of bindService method

The bindService method now returns PostProcessingServerGrpc.bindService(this);, which aligns with the new service binding mechanism introduced by the AsyncService interface.


131-132: Definition of PostProcessingServerStub

The PostProcessingServerStub class extends AbstractAsyncStub, which is appropriate for asynchronous client calls.


159-160: Definition of PostProcessingServerBlockingStub

The PostProcessingServerBlockingStub class extends AbstractBlockingStub, suitable for synchronous client calls.


186-187: Definition of PostProcessingServerFutureStub

The PostProcessingServerFutureStub class extends AbstractFutureStub, allowing for future-style asynchronous client calls.


215-215: Update of serviceImpl to AsyncService

The serviceImpl field in MethodHandlers now uses the AsyncService interface, reflecting the updated design and ensuring flexibility in service implementation.


218-218: Constructor updated to accept AsyncService

The MethodHandlers constructor now accepts an AsyncService instance, ensuring proper handling of the service implementation according to the new interface-based design.


247-257: Introduction of the bindService method

The bindService method facilitates the binding of the AsyncService to the gRPC server, streamlining the service registration process and enhancing maintainability.


101-109: Ensure compatibility with the new AsyncService interface

The introduction of the AsyncService interface and updating PostProcessingServerImplBase to implement it represent significant architectural changes. Please verify that all existing subclasses of PostProcessingServerImplBase are compatible with this new structure and correctly implement the process method as per the interface.

Run the following script to find all classes extending PostProcessingServerImplBase to ensure they are updated accordingly:

This script will identify all subclasses that may need to be reviewed for compatibility with the new AsyncService interface.

✅ Verification successful

Verification Complete: No subclasses of PostProcessingServerImplBase found

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all classes that extend PostProcessingServerImplBase

# Command: Use ast-grep to find classes extending PostProcessingServerImplBase
ast-grep --lang java --pattern $'class $_ extends PostProcessingServerGrpc.PostProcessingServerImplBase { $$$ }'

Length of output: 113


Script:

#!/bin/bash
# Description: Find all classes that extend PostProcessingServerImplBase using ripgrep

# Command: Use rg to search for class declarations extending PostProcessingServerImplBase
rg 'class\s+\w+\s+extends\s+PostProcessingServerImplBase' --type java

Length of output: 71

languagetool-core/src/main/java/org/languagetool/rules/ml/MLServerGrpc.java (6)

8-8: Update gRPC proto compiler version to 1.68.0

Updating the gRPC proto compiler to version 1.68.0 keeps the generated code current with the latest features and improvements of gRPC.


126-141: Introduce AsyncService interface with default methods

The introduction of the AsyncService interface with default methods modernizes the service implementation. This approach promotes flexibility and aligns with best practices introduced in Java 8 and above.


259-262: Refactor MethodHandlers to use AsyncService

Updating the MethodHandlers class to use AsyncService instead of MLServerImplBase aligns method handling with the new interface-based design, ensuring correct method invocations.


295-312: Refactor bindService method for improved service binding

The refactoring of the bindService method enhances the service binding process by making it static and accepting an AsyncService instance. This change simplifies the binding logic and improves the separation of concerns.


337-339: Adjust MLServerMethodDescriptorSupplier for updated method names

Updating the MLServerMethodDescriptorSupplier ensures that method descriptors are correctly supplied for the updated service methods, maintaining accurate service behavior.


146-147: Update MLServerImplBase to implement AsyncService

By updating MLServerImplBase to implement AsyncService, you ensure compatibility with existing implementations while leveraging the benefits of the new interface-based design.

Please verify that all classes extending MLServerImplBase are compatible with this change.

Run the following script to identify implementations of MLServerImplBase:

languagetool-core/src/main/java/org/languagetool/rules/ml/ProcessingServerGrpc.java (11)

8-8: Update to gRPC Proto Compiler Version 1.68.0

The @javax.annotation.Generated annotation now reflects gRPC proto compiler version 1.68.0, which is consistent with the upgrade to Java 17.


15-15: Explicit Typing of SERVICE_NAME Constant

The SERVICE_NAME constant is explicitly typed as java.lang.String. This explicit typing improves code clarity.


126-141: Introduction of AsyncService Interface

The addition of the AsyncService interface with default methods analyze and process enhances modularity and aligns with the latest gRPC generation patterns.


146-147: ProcessingServerImplBase Implements AsyncService

Modifying ProcessingServerImplBase to implement AsyncService ensures that it inherits default method implementations, promoting code reuse and consistency.


150-150: Updated bindService Method

The bindService method now delegates to ProcessingServerGrpc.bindService(this), utilizing the new AsyncService interface for service binding. This improves the scalability of service definitions.


157-158: Consistent ProcessingServerStub Implementation

The ProcessingServerStub class remains consistent with the updated architecture, ensuring asynchronous RPC calls function correctly.


190-191: Consistent ProcessingServerBlockingStub Implementation

The ProcessingServerBlockingStub class continues to support synchronous RPC calls without issues.


221-222: Consistent ProcessingServerFutureStub Implementation

The ProcessingServerFutureStub class maintains compatibility, allowing for future-style RPC calls.


259-262: MethodHandlers Updated to Use AsyncService

Updating MethodHandlers to reference AsyncService instead of ProcessingServerImplBase aligns with the new service implementation strategy.


295-312: Addition of Static bindService Method

The new static bindService method facilitates service binding using the AsyncService interface, enhancing service definition flexibility.


337-339: Updated ProcessingServerMethodDescriptorSupplier

Including the methodName field in ProcessingServerMethodDescriptorSupplier ensures accurate method descriptor retrieval.

languagetool-core/src/main/java/org/languagetool/languagemodel/bert/grpc/BertLmGrpc.java (5)

8-8: Approved: Update to gRPC proto compiler version 1.68.0.

Upgrading to gRPC proto compiler version 1.68.0 ensures compatibility with Java 17 features and benefits from the latest improvements.


15-15: Approved: Explicitly specifying the SERVICE_NAME type.

The SERVICE_NAME constant is now explicitly typed as java.lang.String, enhancing code clarity.


126-141: Approved: Introduction of AsyncService interface with default methods.

The introduction of the AsyncService interface with default methods score and batchScore modernizes the service abstraction, leveraging Java 17 features. This enhances flexibility and maintainability.


259-262: Approved: Update MethodHandlers to use AsyncService.

The MethodHandlers class now references AsyncService instead of BertLmImplBase, reflecting the new service structure.


295-312: Approved: Refactored bindService method for service binding.

The bindService method has been updated to utilize the AsyncService interface, streamlining the service binding process.

languagetool-core/src/main/java/org/languagetool/grpc/Synthesizer.java (1)

Line range hint 4-3456: LGTM: Updates to the generated code are appropriate.

The changes in Synthesizer.java reflect the necessary updates to accommodate Java 17 and the new protocol buffer compiler version. The removal of deprecated constructors and the consistent use of getUnknownFields() improve code clarity and consistency. Suppression of serialization warnings with @SuppressWarnings("serial") is acceptable in this context. No issues found.

languagetool-core/src/main/java/org/languagetool/languagemodel/bert/grpc/BertLmProto.java (5)

4-4: Include Protobuf Java Version Comment

Adding the Protobuf Java version comment enhances code clarity by specifying the compiler version used. This is helpful for future maintenance and debugging.


858-859: Initialize text_ with an empty string

Initializing text_ to an empty string ensures that it has a consistent default value, preventing potential NullPointerException. The @SuppressWarnings("serial") annotation suppresses serialization warnings, which is appropriate here.


1769-1770: Initialize score_ with emptyDoubleList()

The score_ field in Prediction is initialized using emptyDoubleList(). Ensure that any additions to score_ handle the immutability of the list to prevent runtime exceptions.

Check for correct usage with:

#!/bin/bash
# Description: Confirm `score_` is properly modified after initialization

# Search for modifications to `score_` and check for mutability handling
rg --type java -A 2 'score_\.' languagetool-core/src/main/java/org/languagetool/languagemodel/bert/grpc/BertLmProto.java | rg -v 'ensureScoreIsMutable'

121-121: Update field initialization for candidates_

The candidates_ field in the Mask class uses LazyStringArrayList.emptyList() for initialization. Confirm that this change maintains the intended behavior, especially regarding list mutability.

Use the following script to ensure that candidates_ is handled correctly:

#!/bin/bash
# Description: Ensure `candidates_` is properly managed after initialization with `emptyList()`

# Find all methods modifying `candidates_` and check for `ensureCandidatesIsMutable()`
rg --type java -A 2 'candidates_\.' languagetool-core/src/main/java/org/languagetool/languagemodel/bert/grpc/BertLmProto.java | rg -v 'ensureCandidatesIsMutable'

1174-1177: Ensure proper handling in buildPartial() method

The buildPartial() method in the ScoreRequest.Builder class has been updated. Verify that all required fields are correctly set during object construction to prevent incomplete instances.

Consider reviewing the buildPartial() implementations:

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
pom.xml (3)

115-116: Major update: Java version changed to 17

The project has been updated to use Java 17, which is a significant change from the previous version (Java 8). This update brings numerous improvements and new features, but it also requires careful consideration:

  1. Ensure all dependencies are compatible with Java 17.
  2. Review and update the codebase to leverage new Java features where appropriate.
  3. Verify that the build process and deployment environments support Java 17.
  4. Test thoroughly to catch any potential compatibility issues.

Consider creating a separate branch for this update and perform extensive testing before merging into the main branch.


Line range hint 149-240: Multiple dependency version updates

Numerous dependencies have been updated to newer versions. While this is generally good for security and performance, it requires careful consideration:

  1. Review the changelog for each updated dependency, especially for major version changes (e.g., MariaDB JDBC from 2.7.6 to 3.4.1).
  2. Pay special attention to dependencies with breaking changes that might affect the codebase.
  3. Update any code that relies on changed APIs in the updated dependencies.
  4. Conduct thorough testing to ensure compatibility with the updated dependencies.

Notable updates include:

  • org.apache.commons.commons-compress: 1.26.0 -> 1.27.1
  • io.grpc: 1.66.0 -> 1.68.0
  • org.mariadb.jdbc: 2.7.6 -> 3.4.1
  • ch.qos.logback: 1.3.14 -> 1.5.8
  • com.ibm.icu: 70.1 -> 75.1

Consider updating dependencies incrementally and testing each update separately to isolate potential issues.


Line range hint 126-127: Plugin configuration updates and compatibility considerations

The plugin configurations have been updated, with a notable change in the git-commit-id-plugin:

  1. Two versions of the git-commit-id-plugin are now specified:
    • Version 5.0.0 for Java 17
    • Version 4.0.0 for Java 8

This split suggests an effort to maintain compatibility with different Java versions, which is a good practice for a transitional period. However, consider the following:

  1. Ensure that the correct plugin version is used in different build environments.
  2. Verify that both plugin versions produce consistent output for your git information.
  3. Plan for eventual consolidation to a single version once the transition to Java 17 is complete across all environments.

Consider adding comments in the pom.xml file to explain the reason for maintaining two versions of the git-commit-id-plugin. This will help future maintainers understand the rationale behind this configuration.

Also applies to: 1021-1052

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2e70738 and 5a99244.

📒 Files selected for processing (3)
  • languagetool-core/pom.xml (0 hunks)
  • languagetool-server/pom.xml (0 hunks)
  • pom.xml (4 hunks)
💤 Files with no reviewable changes (2)
  • languagetool-core/pom.xml
  • languagetool-server/pom.xml
🧰 Additional context used
🔇 Additional comments (1)
pom.xml (1)

238-238: Address TODO comments and verify HSQLDB compatibility

  1. The HSQLDB version has been updated to 2.7.3. Ensure that this version is compatible with your database schema and usage.

  2. There's a TODO comment indicating the need to check for updates and compatibility, particularly for the following dependencies:

    • org.sweble.wikitext
    • edu.washington.cs.knowitall.opennlp
    • org.mariadb.jdbc

Would you like me to create GitHub issues to track these TODO items? This will ensure that these tasks are not overlooked during the update process.

To help verify the compatibility of the updated HSQLDB version, you can run the following script:

This script will help identify areas of the code that might be affected by the HSQLDB update.

Also applies to: 150-155

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
pom.xml (1)

115-116: Major update: Java version changed to 17

The project has been updated to use Java 17, which is a significant change from the previous version (Java 8). This update brings numerous improvements and new features but also requires careful consideration:

  1. Ensure all dependencies are compatible with Java 17.
  2. Review and update the codebase to leverage new Java features where appropriate.
  3. Verify that all parts of the project, including tests, build correctly with Java 17.
  4. Update CI/CD pipelines to use Java 17.

Consider creating a separate issue to track the migration process and any required code changes or dependency updates.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5a99244 and f2fe92f.

📒 Files selected for processing (1)
  • pom.xml (5 hunks)
🧰 Additional context used
🔇 Additional comments (3)
pom.xml (3)

237-237: HSQLDB dependency update and configuration change

The HSQLDB dependency has been updated from version 2.7.1 to 2.7.3, which is a minor update. Additionally, the jdk8 classifier has been removed, which is consistent with the project's upgrade to Java 17.

These changes are appropriate given the Java version upgrade. No further action is required.


148-152: Numerous dependency version updates

Multiple dependencies have been updated to their latest versions. While this is generally good for security and feature improvements, it requires careful testing:

  1. Apache Commons Compress (1.26.0 to 1.27.1)
  2. gRPC (1.66.0 to 1.68.0)
  3. MariaDB JDBC driver (2.7.6 to 3.4.1) - This is a major version update
  4. Bcrypt (0.6.0 to 0.10.2)
  5. Logback (1.3.14 to 1.5.8)
  6. ICU4J (70.1 to 75.1)
  7. Various other library updates

Ensure thorough testing of all affected components, especially database interactions due to the significant MariaDB driver update. Review changelogs of updated dependencies for any breaking changes or new features that could be leveraged.

Also applies to: 159-160, 168-168, 170-174, 183-185, 192-192, 194-194, 197-200, 203-203, 205-210, 215-217, 223-224, 235-235, 237-239


130-130: Maven plugin updates

The following Maven plugins have been updated:

  1. git-commit-id-plugin to version 5.0.1
  2. flatten-maven-plugin to version 1.6.0

While these updates are minor, it's important to verify that they don't affect the build process. Run a full Maven build to ensure everything works as expected:

Also applies to: 135-135

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradlew.bat (1)

Java 17 is set as the minimum version in Maven build files, but it's not specified in Gradle build files. To fully enforce Java 17 as the minimum across the project, please update the Gradle configurations accordingly.

🔗 Analysis chain

Line range hint 1-94: Note: Discrepancy between PR objective and file changes

While the changes in this file are positive improvements to error handling and licensing clarity, they don't directly address the stated PR objective of setting Java 17 as the minimum version. This Gradle wrapper script doesn't contain any Java version checks or requirements.

To fully achieve the PR objective, additional changes might be needed in other files, such as build configuration files or Java source files, to enforce the Java 17 requirement.

To confirm if Java 17 is set as the minimum version elsewhere in the project, you can run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for Java version specifications in Gradle and Maven build files

echo "Searching for Java version specifications in build files..."

# Check Gradle build files
echo "Gradle build files:"
rg -g '*.gradle' -g '*.gradle.kts' 'sourceCompatibility|targetCompatibility|JavaVersion\.VERSION_17'

# Check Maven POM files
echo "Maven POM files:"
rg -g 'pom.xml' '<java.version>|<maven.compiler.source>|<maven.compiler.target>'

echo "Search complete. Please review the results to confirm Java 17 requirement."

Length of output: 883

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f2fe92f and 0861829.

⛔ Files ignored due to path filters (1)
  • languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradle/wrapper/gradle-wrapper.jar is excluded by !**/*.jar
📒 Files selected for processing (3)
  • languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradle/wrapper/gradle-wrapper.properties (1 hunks)
  • languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradlew (3 hunks)
  • languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradlew.bat (3 hunks)
✅ Files skipped from review due to trivial changes (2)
  • languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradle/wrapper/gradle-wrapper.properties
  • languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradlew
🧰 Additional context used
🔇 Additional comments (3)
languagetool-language-modules/crh/src/main/resources/org/languagetool/resource/crh/dev/gradlew.bat (3)

16-17: LGTM: Addition of SPDX license identifier

The addition of the SPDX license identifier is a good practice. It explicitly states the license of the file and correctly matches the Apache 2.0 license mentioned in the existing license header.


48-52: Improved error handling: Redirecting to stderr

The modification to redirect error messages to stderr (1>&2) is a good improvement. This change:

  1. Separates error messages from regular output.
  2. Makes it easier for automated tools to distinguish between normal output and error messages.
  3. Follows best practices for error handling in shell scripts.

The content of the error messages remains clear and informative.


62-66: Consistent improvement in error handling

This change is consistent with the previous modification, redirecting error messages for an invalid JAVA_HOME to stderr. The benefits include:

  1. Maintaining a uniform approach to error handling throughout the script.
  2. Improving the script's interoperability with other tools and scripts.
  3. Preserving the clarity and content of the error messages.

This consistency in error handling is a positive improvement to the script.

@arysin arysin merged commit f0f8386 into master Oct 20, 2024
6 checks passed
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.

3 participants