Commits
Tarun Sukhani authored cb4cb62dcfe
fix(classloading): start from a warm tmp/bytecode in an application with package-info classes (PF-186) Every play run but the first finds the application's classes in tmp/bytecode, and in an application with a package-info in its packages that start failed: IllegalArgumentException from ClassLoader.definePackage, a 500 for the request that started it. The start that compiles from source never showed it. A package-info read from the cache is defined without being compiled, because the DEV batch compile covers only ordinary classes. So isDefinable() never held for it, and the findLoadedClass check at the top of doLoadApplicationClass leaves package-info names out. A class of the package loads it first through loadPackage; when getAllClasses then reached the package-info itself, it defined its package again. Guarding definePackage alone does not help: the next failure is a LinkageError for a duplicate definition of the package-info class. The loader now returns a package-info it has already defined. The precompiled path had its own findLoadedClass check and is unchanged. The same gap left such a package-info with no timestamp, which only compiled() records, so the next request's detectChanges took every one for edited: it recompiled each, rewrote its cache file, emptied the application's caches and hot-swapped it, or restarted the application when no agent was loaded. A class defined from the cache now records its file's timestamp when no compile has. The cache answers only when the hash of the current source matches, so the bytes are known to match the file, and an edit made later is still found. PackageInfoBytecodeCacheTest boots a scratch application with four package-info packages twice in child JVMs. It fails without either change, and also with a timestamp that would hide later edits. Against a server started as play run starts it, the second launch's first request was a 500 before the fix and serves now, and its second request rewrites no cache file where it rewrote four. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>