[External] : RE: adding an interface to a class

Chen Liang chen.l.liang at oracle.com
Fri Apr 11 00:15:17 UTC 2025


Might be that you have a class that's not java.lang.String but also has this simple name of String. Note that bere is not a technical support channel, and if you are reporting an issue, you should provide steps of reproduction or problem/code analysis.
________________________________
From: Mark Roberts <markro at cs.washington.edu>
Sent: Thursday, April 10, 2025 7:05 PM
To: classfile-api-dev at openjdk.org <classfile-api-dev at openjdk.org>
Cc: Brian Goetz <brian.goetz at oracle.com>; Chen Liang <chen.l.liang at oracle.com>
Subject: [External] : RE: adding an interface to a class


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<mailto:brian.goetz at oracle.com>>
Sent: Wednesday, April 2, 2025 12:25 PM
To: Mark Roberts <markro at cs.washington.edu<mailto:markro at cs.washington.edu>>; Chen Liang <chen.l.liang at oracle.com<mailto:chen.l.liang at oracle.com>>; classfile-api-dev at openjdk.org<mailto: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/20250411/c1e97efd/attachment.htm>


More information about the classfile-api-dev mailing list