On Fri, 13 Mar 2026 10:12:22 GMT, David Beaumont <[email protected]> wrote:

>> src/hotspot/share/classfile/classLoader.cpp line 1474:
>> 
>>> 1472: // Finishes initializing the JImageFile (if present) by setting the 
>>> access mode.
>>> 1473: void ClassLoader::set_preview_mode(bool enable_preview) {
>>> 1474:   assert(Preview_mode == PREVIEW_MODE_UNINITIALIZED, 
>>> "set_preview_mode must not be called twice");
>> 
>> So should this check, or assert, that the JImageFile exists?
>
> Hmmm. It's a code flow assertion making sure this is called at most once, and 
> only after init.
> If the jimage file didn't exist, we should never get to the point where this 
> is called (but that's assuming it's called in the right place I guess).
> So if this were called too early it would fail with a misleading error 
> message I guess. It would never pass spuriously though. I think it's okay as 
> it is, but I'll change it if you want.

Actually, similar to the other comment, this is necessary once exploded image 
support is in because the flag is not necessarily associated with a jimage 
existing.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/29414#discussion_r2930438395

Reply via email to