Would it make sense to make missing/incorrect method errors be above generics errors?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Feb 4 17:13:37 UTC 2025


Hi David,
in general there's nothing preventing us from reordering or presenting 
messages in a different way. In fact, as part of Java 8, we introduced 
some heuristics so that if a method callsite had many potentially 
applicable methods, but only one had the correct arity, we show a much 
more specific error assuming that's the method the user wanted to call.

As for your case, I think it would help if you could boil it down to a 
specific example, so that we can discuss it further, and maybe file an 
issue.

Cheers
Maurizio


On 28/01/2025 19:07, David Alayachew wrote:
> Hello Compiler Dev Team,
>
> I am coming in entirely ignorant of how the compiler works under the 
> hood. I am trying to correct this ignorance, but I hope you'll forgive 
> an ignorant question in the meantime.
>
> Would it make sense to have missing method errors (can't find symbol) 
> be above errors like invalid method references (trying to use 
> non-static method in static context)?
>
> Basically, I am just asking to alter the output order of compile time 
> errors. We all have run into situations where we get this nightmarish 
> generics error, and the actual error is that we mispelled a method 
> name or something. However, the misspelled error is usually beneath 
> the ugly generics error.
>
> If the top of the list was a "can't find symbol", that would make it 
> much more obvious what the problem is. Then, when the problem actually 
> is our generics, then it will be unambiguous as opposed to trying to 
> parse the many errors in compile time.
>
> Of course, if altering error output order is a pandora's box that we 
> don't want to open, then I understand. From my ignorant opinion, 
> altering the output order of an already compiled list seems easy, but 
> maybe there are rules in place that prevent that, or we don't want to 
> mess with people's mental model. Or maybe we are expected to have read 
> the entire list of errors and parse the best next steps only after 
> having read the whole thing lol. I don't know.
>
> Thank you for your time and help.
> David Alayachew


More information about the compiler-dev mailing list