RFR: JDK-8242888: Convert dynamic proxy to hidden classes

liach duke at openjdk.java.net
Tue Apr 19 01:31:24 UTC 2022


On Mon, 18 Apr 2022 20:42:48 GMT, Remi Forax <forax at univ-mlv.fr> wrote:

> The third parameter of defineProxy() is a lambda which is called for each method that can be overriden, either toString/equals/hashCode but also any default methods,
if the lambda return true, the method is overriden, otherwise the default implementation is used.

Not quite, I mean calling default implementations in the super interface, consider:

interface Root { void cleanUp(); }
interface FeatureOne extends Root { default void cleanUp() { /* do something */ } }
interface FeatureTwo extends Root { default void cleanUp() { /* do something */ } }

My proxy implements both feature one and two, but in your API, there is no way for my `cleanUp` to call both `FeatureOne.super.cleanUp();` and `FeatureTwo.super.cleanUp();`. You should probably expose the lookup in your linker too, especially that you enabled nest access and you can just use that lookup to resolve, say, an implementation static method in the proxy user class.

Also the "delegate" in your API would significantly benefit from https://bugs.openjdk.java.net/browse/JDK-8282798 (#7744), too.

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

PR: https://git.openjdk.java.net/jdk/pull/8278


More information about the core-libs-dev mailing list