1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="DescendantToken"> 5 <property name="tokens" value="EQUAL,NOT_EQUAL"/> 6 <property name="limitedTokens" value="STRING_LITERAL"/> 7 <property name="maximumNumber" value="0"/> 8 <property name="maximumDepth" value="1"/> 9 </module> 10 </module> 11 </module> 12 */ 13 package com.puppycrawl.tools.checkstyle.checks.descendanttoken; 14 15 // xdoc section -- start 16 class Example15 { 17 void testMethod1() { 18 String str = "abc"; 19 if (str.equals("abc")) { 20 System.out.println("equal."); 21 } 22 if (str == "abc") { // violation, 'Count of 1 for 'EQUAL' descendant' 23 System.out.println("equal."); 24 } 25 } 26 } 27 // xdoc section -- end