[jdk16] RFR: 8231461: static/instance overload leads to 'unexpected static method found in unbound lookup' when resolving method reference [v2]

Vicente Romero vromero at openjdk.java.net
Tue Jan 12 20:32:23 UTC 2021

On Tue, 12 Jan 2021 19:00:29 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> I guess that the difference between the new code and the previous one is that in the old code when we check if `boundRes.hasKind(StaticKind.STATIC)` we are checking for a global property of all candidates, meaning that for the previous check to be true, all candidates have to be static. And this is not what the spec is saying, as the spec cares about the staticness, or lack of it, of the most specific method found in each search. Does this make sense?
> Ok - I missed that both symbols are applicable in the first search. So while the most specific symbol is the static one, the StaticKind is set to BOTH, since one is static and the other is not. So, yes, using StaticKind for things like "the first/second search returned a static/non-static method" is incorrect. Your patch fixes that.
> I'm dubious as to whether isSuccess is correct though. E.g. isSuccess returns true whenever the StaticKind is != UNDEFINED - but that would also return true in cases where there's an ambiguity in the first search - which I would not describe as a success. Do you agree? If so, can we add a test for that case (e.g. a case where the first search has ambiguous result) and see what happens?

I have uploaded a new commit based on your comments and offline discussion, TIA


PR: https://git.openjdk.java.net/jdk16/pull/107

More information about the compiler-dev mailing list