SONARJAVA-6112 Only one "main" method should be present#5455
SONARJAVA-6112 Only one "main" method should be present#5455
Conversation
062ebc3 to
dffd2f5
Compare
25781e1 to
6915763
Compare
# Conflicts: # sonar-java-plugin/src/main/resources/org/sonar/l10n/java/rules/java/Sonar_way_profile.json # Conflicts: # sonar-java-plugin/src/main/resources/org/sonar/l10n/java/rules/java/Sonar_way_profile.json # Conflicts: # sonar-java-plugin/src/main/resources/org/sonar/l10n/java/rules/java/Sonar_way_profile.json
…ce (priority) child/super
6915763 to
498e9c4
Compare
tomasz-tylenda-sonarsource
left a comment
There was a problem hiding this comment.
See my comment on the sample first. Either I miss something, or we may need to make some changes.
| } | ||
|
|
||
| class Child extends Parent { | ||
| void main(String[] args) { // Noncompliant {{Override main from Parent to avoid introducing multiple main methods.}} |
There was a problem hiding this comment.
Overriding parent main may not be doable if args are used. Am I missing something?
There was a problem hiding this comment.
You are right! however in case parent contains main(), child contains main(String[] args) and uses args, it still makes sense to raise an issue on child's main, even if this issue is not easily fixable. A more accurate issue message for that case could be Do not extends a class that contains main() when you define main(String[] args). What do you think ?
tomasz-tylenda-sonarsource
left a comment
There was a problem hiding this comment.
LGTM with a minor comment on naming.
|




No description provided.