3 ms·
The section on how the main method will be resolved is a bit painful. I can’t see a way around it that doesn’t do nasty things for composability and/or backward
by hyperpape 4y ago
The section on how the main method will be resolved is a bit painful. I can’t see a way around it that doesn’t do nasty things for composability and/or backwards compatibility, but it does give me pause. Any situation where you have to ask “which main method in this class will be executed?” is quite bad.
- pron 4y agoWhich is why, as part of designing this feature, we ran a corpus search to see what portion of classes with a main method have another main that would be a candidate entry point under this JEP. It was negligible. Additionally, we'll give a linter warning if there's more than one candidate.
- pgwhalen 4y agoAs much as it's a crutch in programming language design to say "we don't have to worry too much about the lack of ergonomics in this case, it would be such bad code if this edge case gets run into in the first place," this seems like one of those situations. Another point: IDEs will be able to tell you which main method will get chosen, which should eliminate at least some uncertainty.