1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="EqualsAvoidNull"/> 5 </module> 6 </module> 7 */ 8 9 package com.puppycrawl.tools.checkstyle.checks.coding.equalsavoidnull; 10 11 // xdoc section -- start 12 public class Example1 { 13 public void foo() { 14 String nullString = null; 15 16 // violation below 'String literal expressions should be on the left side' 17 nullString.equals("My_Sweet_String"); 18 "My_Sweet_String".equals(nullString); 19 // violation below 'String literal expressions should be on the left side' 20 nullString.equalsIgnoreCase("My_Sweet_String"); 21 "My_Sweet_String".equalsIgnoreCase(nullString); 22 } 23 } 24 // xdoc section -- end