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

Langer, Christoph christoph.langer at sap.com
Thu Sep 19 21:54:47 UTC 2019


Hi Joe,

thanks for looking into that. Seems like a good idea to update jls-9.6.4.5 then.

Best regards
Christoph

From: Joe Darcy <joe.darcy at oracle.com>
Sent: Dienstag, 17. September 2019 22:01
To: Langer, Christoph <christoph.langer at sap.com>; David Holmes <david.holmes at oracle.com>; hotspot-dev at openjdk.java.net
Subject: Re: RFR (S): 8230854: Cleanup SuppressWarnings in test lib and remove noisy traces in StreamPumper


Hello,

The specification for the SuppressWarnings type states:

"The presence of unrecognized warning names is not an error: Compilers must ignore any warning names they do not recognize. They are, however, free to emit a warning if an annotation contains an unrecognized warning name."
https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/lang/SuppressWarnings.html#value()

Note that the JLS does not repeat this requirement of compilers in its section on @SuppressWarnings:

    https://docs.oracle.com/javase/specs/jls/se13/html/jls-9.html#jls-9.6.4.5

I've filed JDK-8231147 for this issue.

HTH,

-Joe
On 9/13/2019 1:04 AM, Langer, Christoph wrote:

Hi David,



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?

I didn't find any reference either and the IDE says that this is an unknown

annotation. So unless somebody steps up and tells us what it's good for, I guess it can be removed.



Not it is a valid warning. Try compiling with -Xlint:all without the

warning suppressed:



----------System.err:(19/1295)----------

/scratch/users/daholme/jdk-

dev2/open/test/lib/jdk/test/lib/process/ProcessTools.java:91:

warning: [overloads]

startProcess(String,ProcessBuilder,Consumer<String>) in ProcessTools is

potentially ambiguous with

startProcess(String,ProcessBuilder,Predicate<String>) in ProcessTools

     public static Process startProcess(String name,

                           ^



Thanks for taking a closer look here and enlightening me.



@SuppressWarnings("overloads") is supported by javac but not by my Eclipse IDE. One can list supported @SuppressWarnings types with javac -X. You'll get:

overloads            Warn about issues regarding method overloads.



So I now understand what the warning means and why @SuppressWarnings("overloads") is required here. I've also configured my Eclipse to ignore this unknown annotation.



New webrev, keeping @SuppressWarnings("overloads"): http://cr.openjdk.java.net/~clanger/webrevs/8230854.1/



Best regards

Christoph




More information about the hotspot-dev mailing list