On Thu, 6 Apr 2023 16:58:43 GMT, Jorn Vernee <jver...@openjdk.org> wrote:
>> Guess I will just nuke the annotation and check for its implemented clause >> instead. > > I don't think that's good enough. If an instance implements an interface that > just happens to also have an entry in the INTERFACE_INFOS cache, then e.g. > `MethodHandleProxies::wrapperInstanceTarget` could be used to retrieve the > class data of a class that wasn't generated using MethodHandleProxies. > > I think some explicit marker is needed for class generated by > MethodHandleProxies. > > Switching back to the `WrapperInstance` interface, and then defining the > class using `IMPL_LOOKUP`, as opposed to defining the class in a dynamic > module, could be an option (since we determined that the wrapper instance can > not be used to escalate privilege. I'm just not sure if that will work for > target interfaces in non-exported packages. Proxy seems to be able to do that > too though. An other possibility to to add some key into the ClassData that can't be imitated - such as the `InterfaceInfo` itself. An `instanceof` check on the ClassData at a fixed position could then determine if is a MHP. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13197#discussion_r1160052563