diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/threadsafety/ImmutableCheckerTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/threadsafety/ImmutableCheckerTest.java index 9f626182004..7150dd00611 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/threadsafety/ImmutableCheckerTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/threadsafety/ImmutableCheckerTest.java @@ -3556,4 +3556,35 @@ public void enumBound() { """) .doTest(); } + + @Test + public void mutableRecord() { + compilationHelper + .addSourceLines( + "Test.java", + """ + import java.util.List; + import com.google.errorprone.annotations.Immutable; + + @Immutable + // BUG: Diagnostic contains: 'R' has field 'xs' + record R(List xs) {} + """) + .doTest(); + } + + @Test + public void immutableRecord() { + compilationHelper + .addSourceLines( + "Test.java", + """ + import com.google.common.collect.ImmutableList; + import com.google.errorprone.annotations.Immutable; + + @Immutable + record R(ImmutableList xs) {} + """) + .doTest(); + } }