[release/3.13] 修复 CurseForge 源中内容不显示 Minecraft 26.x 版本的问题#6003
Merged
Conversation
Member
Author
|
/gemini review |
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a isKnown method in GameVersionNumber to accurately identify valid Minecraft versions and updates CurseAddon to utilize this method for filtering. A review comment suggests reverting the use of Stream.toList() to collect(Collectors.toList()) to maintain consistency with existing stream operations in the file and to ensure the resulting list remains mutable, preventing potential runtime exceptions.
| return RemoteMod.Dependency.ofGeneral(RELATION_TYPE.get(dependency.getRelationType()), CurseForgeRemoteModRepository.MODS, Integer.toString(dependency.getModId())); | ||
| }).distinct().filter(Objects::nonNull).collect(Collectors.toList()), | ||
| gameVersions.stream().filter(ver -> ver.startsWith("1.") || ver.contains("w")).collect(Collectors.toList()), | ||
| gameVersions.stream().filter(GameVersionNumber::isKnown).toList(), |
Contributor
There was a problem hiding this comment.
为了与当前方法中其他 Stream 操作(如第 588 行和第 596 行)保持一致,并确保返回的列表是可变的,建议在此处继续使用 collect(Collectors.toList())。Stream.toList() 返回的是不可变列表,如果 RemoteMod.Version 的消费者试图对该列表进行排序或修改,可能会触发 UnsupportedOperationException。
Suggested change
| gameVersions.stream().filter(GameVersionNumber::isKnown).toList(), | |
| gameVersions.stream().filter(GameVersionNumber::isKnown).collect(Collectors.toList()), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#5994