-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b39
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8084194 | emb-9 | Claes Redestad | P4 | Resolved | Fixed | team |
A couple of java.lang.NoSuchFieldError shows up in startup profiles which initializes MethodHandleImpl$Lazy, e.g., any nashorn program:
private static MethodHandle[] makeArrays() {
ArrayList<MethodHandle> mhs = new ArrayList<>();
for (;;) {
MethodHandle mh = findCollector("array", mhs.size(), Object[].class);
if (mh == null) break;
mh = makeIntrinsic(mh, Intrinsic.NEW_ARRAY);
mhs.add(mh);
}
assert(mhs.size() == 11); // current number of methods
return mhs.toArray(new MethodHandle[MAX_ARITY+1]);
}
Simply rewriting the for (;;) to for (int i = 0; i < 11; i++) should ensure we don't have to throw exceptions here.
Same goes for makeFillArray, where a for (int i = 1; i < 11; i++) would seem to similarly avoid throwing an exception.
(Since we assert that size == 11 in both cases, it seems we could also do toArray(new MethodHandle[11]) in both methods)
private static MethodHandle[] makeArrays() {
ArrayList<MethodHandle> mhs = new ArrayList<>();
for (;;) {
MethodHandle mh = findCollector("array", mhs.size(), Object[].class);
if (mh == null) break;
mh = makeIntrinsic(mh, Intrinsic.NEW_ARRAY);
mhs.add(mh);
}
assert(mhs.size() == 11); // current number of methods
return mhs.toArray(new MethodHandle[MAX_ARITY+1]);
}
Simply rewriting the for (;;) to for (int i = 0; i < 11; i++) should ensure we don't have to throw exceptions here.
Same goes for makeFillArray, where a for (int i = 1; i < 11; i++) would seem to similarly avoid throwing an exception.
(Since we assert that size == 11 in both cases, it seems we could also do toArray(new MethodHandle[11]) in both methods)
- backported by
-
JDK-8084194 MethodHandleImpl.makeArrays throws and swallows java.lang.NoSuchFieldError in normal flow
-
- Resolved
-