samedi 1 février 2020

Is Double Brace syntax an anti-pattern in Java when used to initialize static constant?

Is Double Brace initialization syntax () really that bad when used to initialize static final constant?

To my knowledge the worst thing about using this pattern is that variable will contain reference to enclosing class, which is very bad especially in production environment. However, this does not seem to be an issue when applied to static constant.

Am I missing something or is it simply a matter of taste in this case?

Aucun commentaire:

Enregistrer un commentaire