8339876: Move constant symbol caches to Utf8EntryImpl

Reviewed-by: redestad
This commit is contained in:
Chen Liang 2024-09-12 15:16:38 +00:00
parent 0765917dea
commit 4d65c3efca
19 changed files with 87 additions and 113 deletions

View file

@ -38,6 +38,8 @@ import java.lang.constant.ClassDesc;
import java.lang.constant.Constable;
import java.util.ArrayList;
import java.util.List;
import jdk.internal.classfile.impl.Util;
import jdk.internal.javac.PreviewFeature;
/**
@ -405,7 +407,7 @@ public sealed interface AnnotationValue {
/** {@return the class descriptor} */
default ClassDesc classSymbol() {
return ClassDesc.ofDescriptor(className().stringValue());
return Util.fieldTypeSymbol(className());
}
}
@ -423,7 +425,7 @@ public sealed interface AnnotationValue {
/** {@return the enum class descriptor} */
default ClassDesc classSymbol() {
return ClassDesc.ofDescriptor(className().stringValue());
return Util.fieldTypeSymbol(className());
}
/** {@return the enum constant name} */
@ -452,7 +454,7 @@ public sealed interface AnnotationValue {
* @param constantName the name of the enum constant
*/
static OfEnum ofEnum(ClassDesc className, String constantName) {
return ofEnum(TemporaryConstantPool.INSTANCE.utf8Entry(className.descriptorString()),
return ofEnum(TemporaryConstantPool.INSTANCE.utf8Entry(className),
TemporaryConstantPool.INSTANCE.utf8Entry(constantName));
}
@ -469,7 +471,7 @@ public sealed interface AnnotationValue {
* @param className the descriptor of the class
*/
static OfClass ofClass(ClassDesc className) {
return ofClass(TemporaryConstantPool.INSTANCE.utf8Entry(className.descriptorString()));
return ofClass(TemporaryConstantPool.INSTANCE.utf8Entry(className));
}
/**