Skip to content

使用 @Language 注解#3907

Merged
Glavo merged 1 commit into
HMCL-dev:mainfrom
burningtnt:feature/ij-language-annotation
May 11, 2025
Merged

使用 @Language 注解#3907
Glavo merged 1 commit into
HMCL-dev:mainfrom
burningtnt:feature/ij-language-annotation

Conversation

@burningtnt

Copy link
Copy Markdown
Member

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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
@burningtnt burningtnt deleted the feature/ij-language-annotation branch May 18, 2025 13:28
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