RFR (S): 8230854: Cleanup SuppressWarnings in test lib and remove noisy traces in StreamPumper

David Holmes david.holmes at oracle.com
Thu Sep 12 04:33:35 UTC 2019


Hi Christoph,

On 11/09/2019 11:25 pm, Langer, Christoph wrote:
> Hi,
> 
> please review this cleanup in test.lib.
> 
> One part is the removal/cleanup of @SuppressWarnings annotations. Some are unnecessary and in Utils.java an unchecked warning can be quiesced.

So in:

test/lib/jdk/test/lib/Platform.java
test/lib/jdk/test/lib/process/ProcessTools.java

in this code

               } catch (PrivilegedActionException e) {
-                 @SuppressWarnings("unchecked")
                   IOException t = (IOException) e.getException();

I take it these are unnecessary as these casts are not unchecked casts?

---

test/lib/jdk/test/lib/Utils.java

No comments.

---

test/lib/jdk/test/lib/process/ProcessTools.java

-     @SuppressWarnings("overloads")
       public static Process startProcess(String name,
                                          ProcessBuilder processBuilder,
                                          final Predicate<String> 
linePredicate)

Unnecessary? I can't find what this warning is supposed to mean. Is it 
used by some IDE's?

> Furthermore, when analyzing some test outputs lately, I got annoyed by stack traces like the following when using jdk.test.lib.process.StreamPumper. I think they are of no particular value and could be suppressed.
> 
> java.io.IOException: Stream closed
> at java.base/java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:169)
> at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:335)
> at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:245)
> at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:285)
> at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:344)
> at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
> at jdk.test.lib.process.StreamPumper.run(StreamPumper.java:109)
> at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
> at java.base/java.lang.Thread.run(Thread.java:830)

Ok. Seems a bit crude, but then the StreamPumper code is crude - just 
running till it hits an exception, but an exception is the only way it 
will detect an async close of the stream.

Thanks,
David
-----

> Bug: https://bugs.openjdk.java.net/browse/JDK-8230854
> Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8230854.0/
> 
> Thanks
> Christoph
> 


More information about the hotspot-dev mailing list