On Tue, 15 Apr 2025 17:59:41 GMT, Calvin Cheung <cche...@openjdk.org> wrote:

>> Timofei Pushkin has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Remove unused imports
>
> src/java.base/share/classes/jdk/internal/misc/CDS.java line 390:
> 
>> 388:             @Override
>> 389:             public byte[] readClassFile(String className) throws 
>> IOException {
>> 390:                 final var subPath = className.replace('.', 
>> File.separatorChar).concat(".class");
> 
> Should File.separatorChar be ‘/‘ ? (just like at line 369)

No, this is an intentional difference.

Here the string is then passed to `Path.of(...)` so it should definitely be 
`File.separatorChar` because this is what `Path.of(...)` expects.

Regarding line 369, the string is then passed to `JarFile.getEntry(String 
name)` — I wasn't able to find the description of the format of the `name` 
parameter so I followed the way `URLClassLoader` does it, it uses `/` for 
loading from a JAR (and `File.separatorChar` for loading from a directory). 
This seems logical since JAR format is platform-independent.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24223#discussion_r2046316431

Reply via email to