]> source.dussan.org Git - jgit.git/commitdiff
UnionInputStreamTest: Suppress ErrorProne warning about missing synchronized 26/130826/3
authorDavid Pursehouse <david.pursehouse@gmail.com>
Fri, 12 Oct 2018 02:07:48 +0000 (11:07 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Wed, 17 Oct 2018 01:29:33 +0000 (10:29 +0900)
Error Prone reports that the unsynchronized method skip overrides the
synchronized method in ByteArrayInputStream [1].

This is a test class, so we can just suppress the warning as recommended
in [1].

Note that the suppression causes a warning in Eclipse, because it doesn't
recognize the "UnsynchronizedOverridesSynchronized" as a valid value for
the @SuppressWarnings annotation [2].

[1] https://errorprone.info/bugpattern/UnsynchronizedOverridesSynchronized
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=392045

Change-Id: I3e798b448211f1363729091f72fb0ef6a873e599
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java

index 0bfa772bed368f08c4f409a7f661836a5ca285f7..a6e0eedfbcc45513548b4f7a9c43d36a9ad5018d 100644 (file)
@@ -167,6 +167,8 @@ public class UnionInputStreamTest {
 
                u.add(new ByteArrayInputStream(new byte[] { 20, 30 }) {
                        @Override
+                       @SuppressWarnings("UnsynchronizedOverridesSynchronized")
+                       // This is only used in tests and is thread-safe
                        public long skip(long n) {
                                return 0;
                        }