RI.IGNOREDCALLAn RI.IGNOREDCALL error appears if there is a call to a method for an immutable class. The method has side effects, and its result is not assigned to a variable (it is just ignored). This can happen because programming assumes a different API when a function modifies the value of its class. The methods that Klocwork looks for are:
Vulnerability and riskMisunderstanding of method behavior will cause flaws in application logic. Mitigation and preventionStore the value return by the method, for example a=a.trim(). Example 113 public void write(String indent, Writer writer) { 14 String description = getDescription(); 15 if (description != null) 16 description.trim(); 17 // ... 18 // write it 19 } RI.IGNOREDCALL is reported for line 16: The value returned by 'java.lang.String.trim()' is ignored. |