Skip to content

使用 @Language 注解 #3907

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

Merged
merged 1 commit into from
May 11, 2025

Conversation

burningtnt
Copy link
Member

使用 https://www.jetbrains.com/help/idea/using-language-injections.html 功能,以移除重复的 Pattern.compile 声明

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the regex pattern definitions by removing redundant Pattern.compile() calls and instead uses string literals annotated with @language for regex injection. The changes simplify and centralize regex initialization in both CrashReportAnalyzer and LibraryAnalyzer.

  • Replace inline Pattern.compile() calls with string literals.
  • Annotate regex inputs with @language and compile them within the constructor.
  • Update affected enum constructors accordingly.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/game/CrashReportAnalyzer.java Simplified regex initialization in Rule enum by using string literals instead of Pattern.compile calls.
HMCLCore/src/main/java/org/jackhuang/hmcl/download/LibraryAnalyzer.java Updated LibraryType constructor and enum constants to use string literals for regex patterns with proper @language annotation.

@Glavo Glavo merged commit d95efc4 into HMCL-dev:main May 11, 2025
2 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.

2 participants