8343881: java.lang.classfile.Attribute attributeName() method should return Utf8Entry

Reviewed-by: liach
This commit is contained in:
Adam Sotona 2024-11-15 11:40:15 +00:00
parent 75c651f859
commit ba39321902
29 changed files with 415 additions and 45 deletions

View file

@ -25,6 +25,7 @@
package java.lang.classfile;
import java.lang.classfile.attribute.*;
import java.lang.classfile.constantpool.Utf8Entry;
import jdk.internal.classfile.impl.BoundAttribute;
import jdk.internal.classfile.impl.UnboundAttribute;
@ -65,7 +66,7 @@ public sealed interface Attribute<A extends Attribute<A>>
/**
* {@return the name of the attribute}
*/
String attributeName();
Utf8Entry attributeName();
/**
* {@return the {@link AttributeMapper} associated with this attribute}

View file

@ -24,6 +24,8 @@
*/
package java.lang.classfile;
import java.lang.classfile.constantpool.Utf8Entry;
import jdk.internal.classfile.impl.TemporaryConstantPool;
import jdk.internal.javac.PreviewFeature;
/**
@ -55,8 +57,8 @@ public abstract non-sealed class CustomAttribute<T extends CustomAttribute<T>>
}
@Override
public final String attributeName() {
return mapper.name();
public Utf8Entry attributeName() {
return TemporaryConstantPool.INSTANCE.utf8Entry(mapper.name());
}
@Override