This is a reimplementation of the `isWrapped` logic in the method: `+[CommonComponentAccessibility createWithParent:accessible:role:index:withEnv:withView:isWrapped:]`
The `isWrapped` arg was used to create an a11y element which is wrapped into an object that does not have direct peer in Java (like `ListRowAccessibility`, `TableRowAccessibility`). The problem is that such objects leak, because when the wrapped element is created (`isWrapped == YES`), the native pointer to the element is rewritten in the associated java peer (the `accessible` arg) and the element object is then released via the `CFRetainedResource` mechanism. However the wrapping object (`ListRowAccessibility`, `TableRowAccessibility`) is never released. This fix proposes a dedicated class for creating such paired objects, where a wrapper object releases its wrapped child when the deallocation is triggered by garbage collecting the associated java peer. ------------- Commit messages: - 8275720: CommonComponentAccessibility.createWithParent isWrapped causes mem leak Changes: https://git.openjdk.java.net/jdk/pull/6081/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6081&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8275720 Stats: 252 lines in 11 files changed: 110 ins; 112 del; 30 mod Patch: https://git.openjdk.java.net/jdk/pull/6081.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/6081/head:pull/6081 PR: https://git.openjdk.java.net/jdk/pull/6081