RFR: 8241151: Incorrect lint warning for no definition of serialVersionUID in a record [v2]

PROgrm_JARvis github.com+7693005+JarvisCraft at openjdk.java.net
Tue Sep 29 22:16:24 UTC 2020


On Tue, 29 Sep 2020 16:03:37 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> test/langtools/tools/javac/records/RecordCompilationTests.java line 151:
>> 
>>> 149:
>>> 150:     public RecordCompilationTests() {
>>> 151:         useAP = System.getProperty("useAP", "false").equals("true");
>> 
>> Can't `Boolean.getBoolean("useAP")` be used here instead?
>
> it could be used, but the test could potentially be executed from command line too and there is no guarantee that the
> system property will be there if executed from the command line

As I understand, call to `Boolean.getBoolean("useAP")` is identical to your variant as it also relies on
`System#getProperty(String)` so I cannot see any different behaviour if using it:
https://github.com/openjdk/jdk/blob/8df3e72cea9217a7a10e2ac4bf4d1501a7fad43c/src/java.base/share/classes/java/lang/Boolean.java#L272-L279

-------------

PR: https://git.openjdk.java.net/jdk/pull/363


More information about the compiler-dev mailing list