ToniAdreal commented on issue #1970:
URL: https://github.com/apache/wicket/issues/1970#issuecomment-7088495189

   I verified the diagnosis independently by reading the code and running the 
exact expression from `examplePages()`.
   
   `ExampleTitlesTest.examplePages()` (lines 86-108) builds class names from 
filesystem paths in exactly one place, line 97:
   
   ```java
   file.substring(0, file.length() - ".class".length()).replace('/', '.')
   ```
   
   and `load()` (lines 110-118) passes that name straight to `Class.forName`. 
Feeding a Windows-style relative path (`ajax\builtin\AjaxApplication$1`, what 
`Path.toString()` returns on Windows) through the line-97 expression leaves the 
backslashes untouched, `.replace('/', '.')` is a no-op on them, so 
`Class.forName` receives 
`org.apache.wicket.examples.ajax\builtin\AjaxApplication$1`. That matches the 
`NoClassDefFoundError (wrong name: ...)` in the report exactly.
   
   I also checked PR #1971: it changes exactly that one line to 
`.replace(File.separatorChar, '.')`. With `separatorChar == '\\'` on Windows 
the same input becomes the correct 
`org.apache.wicket.examples.ajax.builtin.AjaxApplication$1`, and on Linux/macOS 
`separatorChar == '/'`, so behavior there is identical to today. No other spot 
in this file builds class names from paths, so the one-line fix covers it.
   
   Two caveats: I have no Windows box here, so this is a code-path and 
string-transformation verification, not a Windows run. And no CI results have 
reported on the PR head yet.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to