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
publicclassMyClassimplementsDatabase.Batchable<sObject> {
public Database.QueryLocatorstart(Database.BatchableContextbc) {
DatetodayDate=System.today();
StringrecordTypeName='MyRecordType';
Stringquery='SELECT Id FROM Account WHERE RecordType.DeveloperName = :recordTypeName';
if (lastRunOn==null) {
query+=' AND createdDate < :todayDate';
}
returnDatabase.getQueryLocator(query);
}
}
Affects PMD Version:
6.26.0 and 6.29.0
Rule:
UnusedLocalVariable
Description:
Local variables marked as unused despite references in dynamic SOQL queries (strings).
See also Dynamic SOQL
Code Sample demonstrating the issue:
Expected outcome:
This is a false positive since the local variables are referenced inside the query strings. I expect no violation reported.
Running PMD through:
Ant
The text was updated successfully, but these errors were encountered: