From d831fe59d600abd5746e0e5cbe98d184460b0af6 Mon Sep 17 00:00:00 2001 From: Error Prone Team Date: Wed, 13 Dec 2023 17:54:20 -0800 Subject: [PATCH] Test static mutable check PiperOrigin-RevId: 590769082 --- .../bugpatterns/threadsafety/WellKnownMutability.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/WellKnownMutability.java b/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/WellKnownMutability.java index 15d135620db3..e236fa945d2e 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/WellKnownMutability.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/WellKnownMutability.java @@ -299,7 +299,7 @@ private static ImmutableMap buildImmutableClasses( .build(); } - private static ImmutableSet buildMutableClasses(List knownMutables) { + public static ImmutableSet buildMutableClasses(List knownMutables) { return ImmutableSet.builder() .addAll(knownMutables) .addAll(ImmutableCollections.MUTABLE_TO_IMMUTABLE_CLASS_NAME_MAP.keySet()) @@ -308,7 +308,8 @@ private static ImmutableSet buildMutableClasses(List knownMutabl .add(java.util.BitSet.class.getName()) .add(java.util.Calendar.class.getName()) .add(java.lang.Iterable.class.getName()) - .add(java.lang.Object.class.getName()) + // Everything is a subtype of Object so hack remove it + // .add(java.lang.Object.class.getName()) .add("java.text.DateFormat") .add(java.util.ArrayList.class.getName()) .add(java.util.Collection.class.getName())