daniellansun commented on PR #3109: URL: https://github.com/apache/groovy/pull/3109#issuecomment-6870962921
Thanks, Jochen. I have followed both of your suggestions in f123a672245. The generated-name flag is now set on the `GroovyCodeSource` when that source is created, for the anonymous evaluate and parse paths. After compilation, `doParseClass` records the name on the `InnerLoader` only when the flag is set and the compiled main class's simple name matches the name derived from the source. The ThreadLocal is gone, and so are `noteGeneratedScriptName` and `clearGeneratedScriptName` on `GroovyShell` and `GroovyClassLoader`. What remains public is `GroovyCodeSource.setNameGenerated` and `isNameGenerated`. The `parallelLockMap` tests, together with the forked JVM and `--add-opens` setup they needed, have been replaced by a parent loader that records `loadClass` calls, in the same style as GROOVY-9236. For a generated script the parent is not asked for that class, or for its MetaClass, BeanInfo, or Customizer companions. I also corrected `GroovySocketServer.getCodeSource` so that a Windows drive path is opened as a file rather than parsed as a URI. A missing path of that form now fails with `Unable to get script from:`, not `Unable to get script from URI:`. If you would like any of this taken further, I would be glad to follow up. -- 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]
