RFR: 8334252: Verifier error for lambda declared in early construction context [v2]

Archie Cobbs acobbs at openjdk.org
Thu Jun 13 21:57:24 UTC 2024


On Thu, 13 Jun 2024 21:25:10 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Technically, not all constructors invoke `super()` or `this()`, albeit so far, `java.lang.Object` is the only exception.
>> 
>> Of course, it's unlikely that any day soon there will be other examples of this, or that the `java.lang.Object()` constructor will contain a lambda, but if either of those two things ever does happen then this code will still be correct :)
>
>> Technically, not all constructors invoke `super()` or `this()`, albeit so far, `java.lang.Object` is the only exception.
>> 
>> Of course, it's unlikely that any day soon there will be other examples of this, or that the `java.lang.Object()` constructor will contain a lambda, but if either of those two things ever does happen then this code will still be correct :)
> 
> Uhm ok. I asked because scanning for a constructor is a bit heavy. And, now that you bring up Object, perhaps one might argue that the entire constructor body in Object represents a pre-construction context. All things considered, given the remote nature of the scenario you propose (Object is so special that it doesn't really count, and we can even check specifically for it, if needed), combined with the computationally-heavy nature of the method you call, I have a mild preference for just checking if it's a constructor.

I agree it's not worth the trouble to scan - fixed in 6aa8a9a183b.

I added a comment to hint at the minor discrepancy.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19707#discussion_r1638990015


More information about the compiler-dev mailing list