daniellansun commented on PR #3260: URL: https://github.com/apache/groovy/pull/3260#issuecomment-6840261750
Thanks for the suggestions. I added two regression tests in `Groovy12725`, and documented the complete-versus-partial cache invariant next to `DEFAULT_IMPORT_CLASS_AND_PACKAGES_CACHE` and the `known == indexed` check. `defaultImportCacheIsIndependentAcrossClassLoaders` uses a synthetic name `CrossLoaderProbe12725`. Loader A can resolve it only from `groovy.util`, loader B only from `groovy.lang`. Compiling on A, then B, then A again resolves `groovy.util`, then `groovy.lang`, then `groovy.util`. After those three compilations the shared cache holds both packages, in precedence order. The new comments describe a startup cache entry as the complete index, and a replaced entry as only partial information. The distinction is object identity, because updates replace the map entry rather than mutating a shared startup set. I also added `concurrentResolutionsOfTheSameNameHonorEachClassLoader`: eight threads, four rounds, started together with a `CyclicBarrier`. Even threads see only `groovy.util`, odd threads only `groovy.lang`. Each resolution matches that loader, and the final cache contains both packages as an immutable set. The resolution algorithm itself is unchanged. -- 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]
