diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/testdata/BanSerializableReadNegativeCases.java b/core/src/test/java/com/google/errorprone/bugpatterns/testdata/BanSerializableReadNegativeCases.java index aab8505604f..901132d1b8c 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/testdata/BanSerializableReadNegativeCases.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/testdata/BanSerializableReadNegativeCases.java @@ -114,6 +114,19 @@ public static final void directCall3() throws IOException, ClassNotFoundExceptio self.readObject(deserializer); } + // code is for Android + @SuppressWarnings("BanSerializableRead") + public static final void directCall4() throws IOException, ClassNotFoundException { + PipedInputStream in = new PipedInputStream(); + PipedOutputStream out = new PipedOutputStream(in); + + ObjectOutputStream serializer = new ObjectOutputStream(out); + ObjectInputStream deserializer = new ObjectInputStream(in); + + BanSerializableReadPositiveCases self = new BanSerializableReadPositiveCases(); + self.readObject(deserializer); + } + // calls to readObject should themselves be excluded in a readObject method void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { BanSerializableReadNegativeCases c = new BanSerializableReadNegativeCases();