RFR: 8289388: Fix warnings: method is overriding a synchronized method without being synchronized

Andy Goryachev angorya at openjdk.org
Mon Jul 25 17:34:23 UTC 2022


On Sun, 24 Jul 2022 03:57:30 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

> I'm not familiar with the code here, but it should be checked if the overriding method should actually be synchronized. Declaring a method as synchronized is part of its implementation, not its signature, so there can be cases where the overriding method should not be synchronized.

Even though I agree with your statement, I believe it's a good practice to synchronize the overriding method as well - for maintainability reasons.

In this particular case, 2 out of 3 modified methods must be synchronized as they access and modify internal state in non-atomic fashion.  The third one is a simple assert, so in theory it cane be either made sync'd or tagged with @SuppressWarning.  And for maintainability reasons, I'd rather make it sync'd.

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

PR: https://git.openjdk.org/jfx/pull/819


More information about the openjfx-dev mailing list