RFR: 8318812: LauncherHelper.checkAndLoadMain closes jar file that's about to be re-opened [v2]
Sean Coffey
coffeys at openjdk.org
Mon Feb 19 10:32:54 UTC 2024
On Thu, 15 Feb 2024 06:29:24 GMT, Christian Stein <cstein at openjdk.org> wrote:
>> Please review this PR that makes the launcher helper keep a reference to the executable JAR file active after extracting the name of the main class and returning it as Class instance. Now, when loading classes from the JAR file, it hasn't to be re-opened.
>
> Christian Stein has updated the pull request incrementally with two additional commits since the last revision:
>
> - Remove `String jarname` from `getMainClassFromJar`'s signature
> - Introduce and use dedicated on-close error message
src/java.base/share/classes/sun/launcher/LauncherHelper.java line 821:
> 819: // In LM_JAR mode, put the underlying file in the JarFile/ZipFile cache.
> 820: // This will avoid needing to re-parse the manifest when the JAR file
> 821: // is opened on the class path, triggered by Class.forName below.
Nice improvement to have. would it be ok to pad out this comment a bit more ? I found it difficult to understand the specifics. Perhaps :
// In LM_JAR mode, keep the underlying file open to retain it in
// the ZipFile HashMap cache. This will avoid needing to re-parse
// the central directory when the file is opened on the class path,
// triggered by Class.forName below.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17843#discussion_r1494339239
More information about the core-libs-dev
mailing list