Fix DoubleBraceInitialization example

This commit is contained in:
Clément Fournier
2019-07-01 18:33:48 +02:00
parent f6c43c63b6
commit 1a690ed1e8

View File

@ -424,16 +424,15 @@ public class Foo {
</value>
</property>
</properties>
<example>
<![CDATA[
// this is double-brace initialization
return new ArrayList<String>(){{addAll("a","b","c");}};
<example><![CDATA[
// this is double-brace initialization
return new ArrayList<String>(){%raw%}{{ addAll("a","b","c"); }};{%endraw%}
// the better way is to not create an anonymous class:
List<String> a=new ArrayList<>();
a.addAll("a","b","c");
return a;
]]>
// the better way is to not create an anonymous class:
List<String> a = new ArrayList<>();
a.addAll("a","b","c");
return a;
]]>
</example>
</rule>