JDK-8163370 : Reduce number of classes loaded by common usage of java.lang.invoke
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-08-08
  • Updated: 2016-08-18
  • Resolved: 2016-08-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b132Fixed
Description
Various code constructs in java.lang.invoke pull in an excessive amount of classes early during bootstrap. Some non-intrusive refactorings can reduce the number of classes we depend on and load early.

Examples:

- Using an EnumMap<Wrapper, MethodHandle> in sun.misc.invoke.ValueConversions pulls in 5 EnumMap-related classes. Additionally calling values() on an enum class to get the number of enum creates and loads an array class and cause a clone to be allocated every time, which is detrimental to startup performance.
- Using result.addAll(Arrays.asList(buf).subList(0, bufCount)) rather than a simple for-loop pulls in 5 classes