8315678: Classfile API ConstantPool::entryCount and ConstantPool::entryByIndex methods are confusing

Reviewed-by: briangoetz
This commit is contained in:
Adam Sotona 2023-09-14 18:30:39 +00:00
parent 6d47fc6d5b
commit ca747f09b6
40 changed files with 120 additions and 70 deletions

View file

@ -63,8 +63,8 @@ public class InnerClassesHierarchyTest extends TestResult {
for (File file : Arrays.asList(classDir.listFiles(filter))) {
ClassModel classFile = readClassFile(file);
String className = classFile.thisClass().name().stringValue();
for (int i = 1; i < classFile.constantPool().entryCount(); ++i) {
if (classFile.constantPool().entryByIndex(i) instanceof ClassEntry classInfo
for (PoolEntry pe : classFile.constantPool()) {
if (pe instanceof ClassEntry classInfo
&& classInfo.asSymbol().isClassOrInterface()) {
String cpClassName = classInfo.asInternalName();
if (isInnerClass(cpClassName)) {