<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;}
@font-face
{font-family:"Courier New \,serif\;color\:black";
panose-1:2 7 3 9 2 2 5 2 4 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.m-6906457239650474240pl-en
{mso-style-name:m_-6906457239650474240pl-en;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="en-CZ" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">I understand the benefits having default class hierarchy resolver configuration its own privileged access to the system class loader, however such “default” probably
should not be available for external use and even JDK-internal use differs case by case. I think it should be user responsibility to deal with security manager when needed.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Adam<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Mandy Chung <mandy.chung@oracle.com><br>
<b>Date: </b>Thursday, 1 June 2023 2:47<br>
<b>To: </b>liangchenblue@gmail.com <liangchenblue@gmail.com>, Adam Sotona <adam.sotona@oracle.com><br>
<b>Cc: </b>classfile-api-dev <classfile-api-dev@openjdk.org><br>
<b>Subject: </b>Re: ClassHierarchyResolver changes for the Classfile object<o:p></o:p></span></p>
</div>
<p>It's a question to the ClassHierarchyResolver interaction with the security manager. Although it's deprecated for removal, we still need to consider when it's installed and whether the API would throw SecurityException due to the security permission check
or the implementation is safe to use the system class loader loading resources with privilege.<o:p></o:p></p>
<p>Mandy<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">On 5/31/23 5:32 PM, - wrote:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">The doPrivileged is from Mandy Chung's modification to my patch of reimplementation of MethodHandleProxies.asInterfaceInstance. It allows system code to fetch from system classloader with security manager,
but I can just leave this change to be part of that patch instead.<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">On Thu, Jun 1, 2023, 1:34 AM Adam Sotona <<a href="mailto:adam.sotona@oracle.com">adam.sotona@oracle.com</a>> wrote:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">classfile-api-dev <<a href="mailto:classfile-api-dev-retn@openjdk.org" target="_blank">classfile-api-dev-retn@openjdk.org</a>> on behalf of
<a href="mailto:liangchenblue@gmail.com" target="_blank">liangchenblue@gmail.com</a> <<a href="mailto:liangchenblue@gmail.com" target="_blank">liangchenblue@gmail.com</a>><br>
<b>Date: </b>Wednesday, 31 May 2023 8:26<br>
<b>To: </b>classfile-api-dev <<a href="mailto:classfile-api-dev@openjdk.org" target="_blank">classfile-api-dev@openjdk.org</a>><br>
<b>Subject: </b>ClassHierarchyResolver changes for the Classfile object</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt;margin-left:36.0pt">
<span style="font-size:11.0pt">Hello,<br>
Since we are migrating to the Classfile object (8308899), which was<br>
initiated by our observation that Class hierarchy resolvers shouldn't<br>
always cache their results, I wonder what changes I should adapt to my<br>
current patch (8304425, PR #13082).<br>
<br>
We have already decided a few API changes for the resolver:<br>
1. Remove the default hierarchy resolver (at least change to static<br>
factories), caching is bound to Classfile lifetime<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt">Yes, but we need to check performance impact on existing use cases (where to extra hold Classfile instance with cache).</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt">
<span style="font-size:11.0pt">2. Two new resolver factories: Bytecode/resource parsing and<br>
classloading/reflection from a given classloader (The goal of this<br>
patch)<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt">Yes.</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt">
<span style="font-size:11.0pt"><br>
3. The resolution result ClassHierarchyInfo will be converted into an<br>
interface; record is an implementation detail (TBD)<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt">This can go even further. To save footprint ClassHierarchyInfo does not need to expose anything, it does not need to carry thisClass
and all interface infos can point to a singleton object, something like this:</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">/**</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;color:black"> * <b>Information</b></span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><b><span style="font-size:11.0pt;color:black">about</span></b><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><b><span style="font-size:11.0pt;color:black">a</span></b><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><b><span style="font-size:11.0pt;color:black">resolved</span></b><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><b><span style="font-size:11.0pt;color:black">class</span></b><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><b><span style="font-size:11.0pt;color:black">or</span></b><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><b><span style="font-size:11.0pt;color:black">interface.</span></b><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">*/</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">sealed</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">interface</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
<b><i>ClassHierarchyInfo</i></b></span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">permits</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black"> ClassHierarchyImpl.<i>ClassHierarchyInfoImpl</i> {</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black"> </span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">/**</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;color:black"> * {<b>@return</b></span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">the {<b>@link</b></span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">ClassHierarchyInfo} of</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">an</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">interface}</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;color:black"> * no</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">other</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">information</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">about</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">interface</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">is</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">required</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">*/</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">static</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
<i>ClassHierarchyInfo</i> <b><i>ofInterface</i></b>() {</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">return</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black"> ClassHierarchyImpl.</span><i><span style="font-size:11.0pt;color:black">INTERFACE_INFO_INSTANCE</span></i><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">;</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black"> }</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black"> </span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">/**</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;color:black"> * <b>@return</b></span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">the {<b>@link</b></span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">ClassHierarchyInfo} of</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">an</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">interface</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;color:black"> * <b>@param</b></span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black"> superClass
</span><span style="font-size:11.0pt;color:black">information</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">about</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">super</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">of</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">the</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">class</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">is</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">required</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">*/</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">static</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
<i>ClassHierarchyInfo</i> <b><i>ofClass</i></b>(ClassDesc superClass) {</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">return</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black">
</span><span style="font-size:11.0pt;color:black">new</span><span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black"> ClassHierarchyImpl.ClassHierarchyInfoImpl(superClass);</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black"> }</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white">
<span style="font-size:11.0pt;font-family:"Courier New \,serif\;color\:black";color:black"> }</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt">
<span style="font-size:11.0pt"><br>
<br>
What should I do with my patch? Should I drop the changes to default<br>
resolver (which adds security manager suppression) and move on with<br>
the current content, or should I expand it to address all 3 planned<br>
changes (despite some of them still in drafting phase) and accomodate<br>
to the Classfile object? (We still have to decide about the default<br>
resolver fo a Classfile object, esp. whether to have one or not)<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt">I’m not sure why the default class hierarchy resolver should call
</span><span style="font-size:11.0pt">AccessController.doPrivileged</span><span lang="EN-US" style="font-size:11.0pt">?</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span class="m-6906457239650474240pl-en"><span lang="EN-US" style="font-size:9.0pt;font-family:Menlo"> </span></span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"><br>
</span><span lang="EN-US" style="font-size:11.0pt">Thanks,</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt">Adam</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</body>
</html>