8340024: In ClassReader, extract a constant for the superclass supertype_index

Backport-of: 68c4f36857
This commit is contained in:
Severin Gehwolf
2025-04-17 13:19:34 +00:00
committed by Vitaly Provodin
parent a79f790e26
commit c030c1734d

View File

@@ -2286,6 +2286,12 @@ public class ClassReader {
this.attributes = attributes;
}
/**
* A supertype_index value of 65535 specifies that the annotation appears on the superclass
* in an extends clause of a class declaration, see JVMS 4.7.20.1
*/
public static final int SUPERCLASS_INDEX = 65535;
@Override
public Void visitClassSymbol(Symbol.ClassSymbol s, Void unused) {
ClassType t = (ClassType) s.type;
@@ -2295,7 +2301,7 @@ public class ClassReader {
interfaces.add(addTypeAnnotations(itf, classExtends(i++)));
}
t.interfaces_field = interfaces.toList();
t.supertype_field = addTypeAnnotations(t.supertype_field, classExtends(65535));
t.supertype_field = addTypeAnnotations(t.supertype_field, classExtends(SUPERCLASS_INDEX));
if (t.typarams_field != null) {
t.typarams_field =
rewriteTypeParameters(