<div dir="ltr"><div>Here is the link:<br></div><a href="https://github.com/portablesimula/SimulaCompiler2/blob/main/Simula/src/simula/compiler/utilities/ClassHierarchy.java" target="_blank">https://github.com/portablesimula/SimulaCompiler2/blob/main/Simula/src/simula/compiler/utilities/ClassHierarchy.java</a><br><div><br></div><div>I use:</div><div>openjdk version "24-ea" 2025-03-18<br>OpenJDK Runtime Environment (build 24-ea+16-1800)<br>OpenJDK 64-Bit Server VM (build 24-ea+16-1800, mixed mode, sharing)<br></div><div><br></div><div>- Øystein</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 18, 2024 at 9:51 AM Chen Liang <<a href="mailto:liangchenblue@gmail.com" target="_blank">liangchenblue@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Øystein, can you share a link to your ClassHierarchy code? ClassFile API has a layer of caching for the ClassHierarchyResolver it uses, which can lead to it not updating to the latest information in your ClassHierarchy.<div><br></div><div>Chen</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 18, 2024 at 2:40 AM Øystein Myhre Andersen <<a href="mailto:o.myhre@gmail.com" target="_blank">o.myhre@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="padding:0px 0px 0px 2px"><div style="color:rgb(0,0,0);font-family:Consolas;font-size:10pt;white-space:pre-wrap"><p style="margin:0px">Below is a snippet of my code:</p><p style="margin:0px"><br></p><p style="margin:0px">    public byte[] buildClassFile() {</p><p style="margin:0px">                ClassDesc CD_ThisClass = currentClassDesc();</p><p style="margin:0px">            ClassDesc CD_SuperClass = superClassDesc();</p><p style="margin:0px">             ClassHierarchy.addClassToSuperClass(CD_ThisClass, CD_SuperClass);</p><p style="margin:0px">               try {</p><p style="margin:0px">                   byte[] bytes = ClassFile.of(ClassFile.ClassHierarchyResolverOption.of(ClassHierarchy.getResolver())).build(CD_ThisClass,</p><p style="margin:0px"><br></p><p style="margin:0px">                      ...</p><p style="margin:0px">                     </p><p style="margin:0px">                        return(bytes);</p><p style="margin:0px">          } catch(Throwable e) {</p><p style="margin:0px">                  ClassHierarchyResolver resolver = ClassHierarchy.getResolver();</p><p style="margin:0px">                 </p><p style="margin:0px">                        ClassDesc <span style="text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:rgb(255,128,64)">desc</span> = ClassDesc.of("simulaFEC.CLASS_CHECKER1_semchecker1_<span style="text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:rgb(255,128,64)">exp</span>");</p><p style="margin:0px">                      System.out.println("classInfo("+<span style="text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:rgb(255,128,64)">desc</span>+") = " + resolver.getClassInfo(<span style="text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:rgb(255,128,64)">desc</span>));</p><p style="margin:0px"><br></p><p style="margin:0px">                 e.printStackTrace();</p><p style="margin:0px">                    return null;</p><p style="margin:0px">            }</p><p style="margin:0px">       }</p><p style="margin:0px">       </p><p style="margin:0px">When I run this code I get:</p><p style="margin:0px"><br></p><p style="margin:0px">classInfo(ClassDesc[CLASS_CHECKER1_semchecker1_<span style="text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:rgb(255,128,64)">exp</span>]) = ClassHierarchyInfoImpl[superClass=ClassDesc[RTS_CLASS], isInterface=false]</p><p style="margin:0px">java.lang.IllegalArgumentException: Could not resolve class CLASS_CHECKER1_semchecker1_<span style="text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:rgb(255,128,64)">exp</span></p><p style="margin:0px">  at java.base/jdk.internal.classfile.impl.ClassHierarchyImpl.resolve(ClassHierarchyImpl.java:76)</p><p style="margin:0px"> at java.base/jdk.internal.classfile.impl.ClassHierarchyImpl.isInterface(ClassHierarchyImpl.java:86)</p><p style="margin:0px">     at java.base/jdk.internal.classfile.impl.StackMapGenerator$Type.mergeReferenceFrom(StackMapGenerator.java:1334)</p><p style="margin:0px">    .....</p><p style="margin:0px">    </p><p style="margin:0px">    </p><p style="margin:0px">I use my own 'resolver' which answers that 'CLASS_CHECKER1_semchecker1_<span style="text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:rgb(255,128,64)">exp</span>' is a subclass of 'RTS_CLASS'.</p><p style="margin:0px">I don't understand this.</p><p style="margin:0px"><br></p><p style="margin:0px">- <span style="text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:rgb(255,128,64)">Øystein</span> <span style="text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:rgb(255,128,64)">Myhre</span> <span style="text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:rgb(255,128,64)">Andersen</span></p><p style="margin:0px"></p></div></div></div>
</blockquote></div>
</blockquote></div>