SONARJAVA-6105 Update MethodTreeUtils.isMainMethod to recognize Java 25 instance main#5448
Merged
tomasz-tylenda-sonarsource merged 4 commits intomasterfrom Feb 10, 2026
Merged
Conversation
Contributor
rombirli
approved these changes
Feb 9, 2026
Contributor
rombirli
left a comment
There was a problem hiding this comment.
Looks good to me with comments
Comment on lines
+51
to
+53
|
|
||
| public static boolean isMainMethod(MethodTree m) { | ||
| public static boolean isMainMethod(MethodTree m, JavaVersion javaVersion) { | ||
| return javaVersion.asInt() < 25 ? isMainMethodTraditional(m) : isMainMethodJava25(m); |
Contributor
There was a problem hiding this comment.
could we reuse this function instead isJava25Compatible of the javaVersion.asInt() < 25
Contributor
Author
There was a problem hiding this comment.
Yes, it needs to be merged first, so I temporarily use < 25. I created this PR as a ready, so that others know what I'm working on, but I was still in process of cleaning it up and wating for other changes.
Contributor
Author
There was a problem hiding this comment.
Updated.
dd3614f to
d65f2ee
Compare
…odThrowsExceptionCheckInstanceMainSample.java Co-authored-by: rombirli <56340680+rombirli@users.noreply.github.com>
c6ab2ba to
cecff94
Compare
|
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.




No description provided.