]> source.dussan.org Git - jgit.git/commitdiff
[errorprone] RefDatabase: #getConflictingNames immutable return 03/1203403/1
authorIvan Frade <ifrade@google.com>
Thu, 31 Oct 2024 19:55:31 +0000 (12:55 -0700)
committerIvan Frade <ifrade@google.com>
Thu, 31 Oct 2024 19:59:10 +0000 (12:59 -0700)
Errorprone reports that: This method returns both mutable and
immutable collections or maps from different paths. This may be
confusing for users of the method.

Return always an immutable collection.

Change-Id: Id48f3645fd06c8bc72212af180d7d02c7e0b7632

org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java

index 2cf24185c7b6f101f3624c5a5968d64550453418..114246beb2094348366afdc6aa27d508e6d28420 100644 (file)
@@ -160,7 +160,7 @@ public abstract class RefDatabase {
                        if (existing.startsWith(prefix))
                                conflicting.add(existing);
 
-               return conflicting;
+               return Collections.unmodifiableList(conflicting);
        }
 
        /**