Skip to content

SONARJAVA-6105 Update MethodTreeUtils.isMainMethod to recognize Java 25 instance main#5448

Merged
tomasz-tylenda-sonarsource merged 4 commits intomasterfrom
tt/SONARJAVA-6105_method-tree-utils
Feb 10, 2026
Merged

SONARJAVA-6105 Update MethodTreeUtils.isMainMethod to recognize Java 25 instance main#5448
tomasz-tylenda-sonarsource merged 4 commits intomasterfrom
tt/SONARJAVA-6105_method-tree-utils

Conversation

@tomasz-tylenda-sonarsource
Copy link
Copy Markdown
Contributor

No description provided.

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title S6105 Update MethodTreeUtils.isMainMethod to recognize Java 25 instance main SONARJAVA-6110 S6105 Update MethodTreeUtils.isMainMethod to recognize Java 25 instance main Feb 9, 2026
@hashicorp-vault-sonar-prod
Copy link
Copy Markdown
Contributor

hashicorp-vault-sonar-prod Bot commented Feb 9, 2026

SONARJAVA-6110

@tomasz-tylenda-sonarsource tomasz-tylenda-sonarsource changed the title SONARJAVA-6110 S6105 Update MethodTreeUtils.isMainMethod to recognize Java 25 instance main SONARJAVA-6105 Update MethodTreeUtils.isMainMethod to recognize Java 25 instance main Feb 9, 2026
Copy link
Copy Markdown
Contributor

@rombirli rombirli left a comment

Choose a reason for hiding this comment

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

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);
Copy link
Copy Markdown
Contributor

@rombirli rombirli Feb 9, 2026

Choose a reason for hiding this comment

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

could we reuse this function instead isJava25Compatible of the javaVersion.asInt() < 25

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@tomasz-tylenda-sonarsource tomasz-tylenda-sonarsource force-pushed the tt/SONARJAVA-6105_method-tree-utils branch from dd3614f to d65f2ee Compare February 9, 2026 13:13
@sonarqube-next
Copy link
Copy Markdown

@tomasz-tylenda-sonarsource tomasz-tylenda-sonarsource merged commit a0a1b50 into master Feb 10, 2026
16 checks passed
@tomasz-tylenda-sonarsource tomasz-tylenda-sonarsource deleted the tt/SONARJAVA-6105_method-tree-utils branch February 10, 2026 15:51
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