adding an interface to a class

Mark Roberts markro at cs.washington.edu
Fri Apr 11 00:05:13 UTC 2025


I must be missing something.  This works:

      ClassDesc cd = ClassDesc.of(name); // (name is string containing
binary name)

      ClassEntry ce = poolBuilder.classEntry(cd);



But this gets a compile error:

      Utf8Entry ue = poolBuilder.uft8Entry(name); // (name is string
containing internal form)



daikon/dcomp/ClassGen24.java:103: error: cannot find symbol

    Utf8Entry ue = poolBuilder.uft8Entry(name);

                                                   ^

  symbol:   method uft8Entry(String)

  location: variable poolBuilder of type ConstantPoolBuilder



      ClassEntry ce = poolBuilder.classEntry(ue);



Thank you,

Mark





*From:* Brian Goetz <brian.goetz at oracle.com>
*Sent:* Wednesday, April 2, 2025 12:25 PM
*To:* Mark Roberts <markro at cs.washington.edu>; Chen Liang <
chen.l.liang at oracle.com>; classfile-api-dev at openjdk.org
*Subject:* Re: adding an interface to a class



Correct.  (For bonus points, you should also check to make sure it is not
already in the list of implemented interfaces.)

On 4/2/2025 3:12 PM, Mark Roberts wrote:

I might be missing something, but I see only a method to set all the
interfaces of a class.  So to add an interface I have to get the current
list of interfaces, add mine to it and then reset the entire list.  Is that
correct?



Thank you,

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20250410/6288b73b/attachment-0001.htm>


More information about the classfile-api-dev mailing list