Synchronized classes have no public members

Bruno Medeiros via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 20 11:15:04 PDT 2015


On 16/10/2015 08:02, Jacob Carlborg wrote:
> On 2015-10-16 08:49, Dicebot wrote:
>
>> As far as I understand topic is about deprecating direct field access of
>> synchronized classes, method calls in synhronized classes and
>> `synchronized () {}` blocks will remain untouched.
>
> Is it even possible to do synchronized classes in Java? That is, but
> synchronized on the class declaration as in D.
>

No, it's not possible. `synchronized` in Java can only apply to methods, 
or the synchronized statement.

And (for a change), rightly so that it's not possible. This synchronized 
class feature seems to me a clumsy mis-feature. At first glance at least.

-- 
Bruno Medeiros
https://twitter.com/brunodomedeiros


More information about the Digitalmars-d mailing list