summaryrefslogtreecommitdiff
path: root/plugins/InspectionGadgets/src/inspectionDescriptions/DoubleBraceInitialization.html
blob: e2cf8b607f66fceed99ced0542f7d0b2cb91727a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
<html>
<body>
Reports <a href="http://www.c2.com/cgi/wiki?DoubleBraceInitialization">Double Brace Initialization</a>.
Double brace initialization can cause memory leaks when used from a non-<b>static</b> context,
because the anonymous <b>class</b> created will maintain a reference to the surrounding object.
It has worse performance than regular initialization because of the additional class loading required.
It can cause <b>equals()</b> comparisons to fail, if the <b>equals()</b> method does not accept subclasses as parameter (see link above).
And finally, it cannot be combined with Java 7 diamond operator, because that cannot be used with anonymous classes.
<!-- tooltip end -->
<p>
  <small>New in 14</small>
</body>
</html>