mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-05 16:51:18 +00:00
8386802: ClassFile Util.entryList should consider non-RandomAccess lists
Reviewed-by: liach
This commit is contained in:
parent
9a85921177
commit
92b0565b00
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -189,16 +189,18 @@ public final class Util {
|
||||
|
||||
public static List<ClassEntry> entryList(List<? extends ClassDesc> list) {
|
||||
var result = new Object[list.size()]; // null check
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = TemporaryConstantPool.INSTANCE.classEntry(list.get(i));
|
||||
int i = 0;
|
||||
for (var entry : list) {
|
||||
result[i++] = TemporaryConstantPool.INSTANCE.classEntry(entry);
|
||||
}
|
||||
return SharedSecrets.getJavaUtilCollectionAccess().listFromTrustedArray(result);
|
||||
}
|
||||
|
||||
public static List<ModuleEntry> moduleEntryList(List<? extends ModuleDesc> list) {
|
||||
var result = new Object[list.size()]; // null check
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = TemporaryConstantPool.INSTANCE.moduleEntry(TemporaryConstantPool.INSTANCE.utf8Entry(list.get(i).name()));
|
||||
int i = 0;
|
||||
for (var entry : list) {
|
||||
result[i++] = TemporaryConstantPool.INSTANCE.moduleEntry(entry);
|
||||
}
|
||||
return SharedSecrets.getJavaUtilCollectionAccess().listFromTrustedArray(result);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user