From 94dc7082bb13f327c5ab3bb4aedc4e3eb48af710 Mon Sep 17 00:00:00 2001 From: Karl von Randow Date: Wed, 18 Mar 2026 05:01:46 +1300 Subject: [PATCH] Bug fix: make cache fields non-static to match instance synchronization The cache fields were static but synchronized methods use instance-level locking, which would not protect the shared map if multiple instances were created. --- src/org/violetlib/vappearances/AppearancesCache.java | 2 +- src/org/violetlib/vappearances/SystemColorsCache.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/violetlib/vappearances/AppearancesCache.java b/src/org/violetlib/vappearances/AppearancesCache.java index 132cf72..d07d1e9 100644 --- a/src/org/violetlib/vappearances/AppearancesCache.java +++ b/src/org/violetlib/vappearances/AppearancesCache.java @@ -15,7 +15,7 @@ /* package private */ final class AppearancesCache { - private static final @NotNull Map cache = new HashMap<>(); + private final @NotNull Map cache = new HashMap<>(); public final static class Result { diff --git a/src/org/violetlib/vappearances/SystemColorsCache.java b/src/org/violetlib/vappearances/SystemColorsCache.java index d0e453f..e47a583 100644 --- a/src/org/violetlib/vappearances/SystemColorsCache.java +++ b/src/org/violetlib/vappearances/SystemColorsCache.java @@ -17,7 +17,7 @@ /* package private */ final class SystemColorsCache { - private static final @NotNull Map> cache = new HashMap<>(); + private final @NotNull Map> cache = new HashMap<>(); public synchronized void clear() {