You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected outcome:
The variable is used in the query.
In the line 2 List<SObject> objectsToQuery = this.getOldRecords(); and this variable is used in the line String.escapeSingleQuotes(relatedObjectName) + ' WHERE ' + String.escapeSingleQuotes(relatedFieldName) + ' IN :objectsToQuery';
Affects PMD Version:
version 7.1.0 and 7.0.0
Rule:
UnusedLocalVariable
Description:
The rule UnusedLocalVariable doesn't detect the binding of a variable on a String Query. See Salesforce's docs: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_variables.htm
Code Sample demonstrating the issue:
Expected outcome:
The variable is used in the query.
In the line 2
List<SObject> objectsToQuery = this.getOldRecords();
and this variable is used in the lineString.escapeSingleQuotes(relatedObjectName) + ' WHERE ' + String.escapeSingleQuotes(relatedFieldName) + ' IN :objectsToQuery';
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Thank you in advance!
The text was updated successfully, but these errors were encountered: