RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion

Johannes Kuhn jkuhn at openjdk.org
Wed Mar 29 00:34:32 UTC 2023


On Wed, 29 Mar 2023 00:25:09 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line 338:
>> 
>>> 336:                     .aload(1)
>>> 337:                     .ifThenElse(Opcode.IF_ACMPEQ, CodeBuilder::iconst_1, CodeBuilder::iconst_0)
>>> 338:                     .ireturn());
>> 
>> The object methods could be left untouched, as the class inherits the default implementation from `java.lang.Object`. Interfaces can't have default methods with those signatures.
>
> Do interfaces still implement these properly without definition if they extend interfaces that declare `@Override boolean equals();` etc.?

Yes. You can use [`Comperator<T>`][1]  as test.

[1]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Comparator.html#equals(java.lang.Object)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13197#discussion_r1151280131


More information about the core-libs-dev mailing list