From fc23f9798ee4d279a261ebb6f3ac39f77643817d Mon Sep 17 00:00:00 2001 From: cpovirk Date: Mon, 18 May 2026 18:38:37 -0700 Subject: [PATCH] Enable `AbstractToString:JoinerIterable`. #coding-mcp Startblock: diffbase PiperOrigin-RevId: 917533619 --- .../inject/MoreThanOneScopeAnnotationOnClass.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/inject/MoreThanOneScopeAnnotationOnClass.java b/core/src/main/java/com/google/errorprone/bugpatterns/inject/MoreThanOneScopeAnnotationOnClass.java index 9fd117c5b48..702ee8f0d83 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/inject/MoreThanOneScopeAnnotationOnClass.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/inject/MoreThanOneScopeAnnotationOnClass.java @@ -63,7 +63,7 @@ public final Description matchClass(ClassTree classTree, VisitorState state) { return buildDescription(classTree) .setMessage( "This class is annotated with more than one scope annotation: " - + annotationDebugString(scopeAnnotations) + + annotationDebugString(scopeAnnotations, state) + ". However, classes can only have one scope annotation applied to them. " + "Please remove all but one of them.") .build(); @@ -72,7 +72,8 @@ public final Description matchClass(ClassTree classTree, VisitorState state) { return Description.NO_MATCH; } - private static String annotationDebugString(List scopeAnnotations) { - return Joiner.on(", ").join(scopeAnnotations); + private static String annotationDebugString( + List scopeAnnotations, VisitorState state) { + return Joiner.on(", ").join(scopeAnnotations.stream().map(state::getSourceForNode).iterator()); } }