refactor: port TileCache to Java

The first port free to change shape rather than preserve it: TileCache has zero
downstream references in bytecode and does not appear in guidenh's reflective
names. map() became a java.util.Map, add/remove became void, and apply returns
a nullable FlaggedTile instead of a scala.Option. No internal caller used any
of the discarded return values.

Dropped TileCache$, TileCache$FlaggedTile$ and FlaggedTile's case-class
machinery. It is only ever a map value, never compared, hashed, printed or
destructured.

findTile is unchanged, including the branch the reference obscures: its
trailing 'case _ => null' is unreachable because Some(FlaggedTile(t, rem))
matches whatever the flag holds, so a tile flagged removed is returned like any
other and only the warning is suppressed. That is pinned by a functional test
written before the port.

114 plain-JVM tests and 13 Forge server tests pass; the only test change is the
two-line adapter that stopped unwrapping a scala.Option.
This commit is contained in:
Algent committed 2026-08-15 16:23:47 +02:00
1 parent b92d4b7af4
commit 31ec83f91b
6 files changed
+147 -54

No files matched your search

@@ -109,8 +109,7 @@ class TileCacheCharacterizationTest {
// The two adapters below are the only places the cache's collection types are named.
private static TileCache.FlaggedTile entryAt(BlockCoord coord) {
scala.Option<TileCache.FlaggedTile> entry = TileCache.apply(coord);
return entry.isDefined() ? entry.get() : null;
return TileCache.apply(coord);
}
private static int cacheSize() {