salesforcepmd

PMD Salesforce Code Analyzer error "invalid type" for custom object


I'm trying to comply with Salesforce Code Analyzer, but I found a strange error with an Apex class.

The class was designed to be called from an Apex trigger (originally, the trigger had the logic, but now it simply calls to the class).

Since the class does DML operations, I'm trying to avoid those operations within loops.

Here is the class:

public without sharing class BC_ClaseCierraAtencion {
    public static void cierra(List<BC_Atenci_n__c> atenciones){
        // do stuff...        
    }
}

Note the class does the job (there's no error in the operation.)

The Code Analyzer shows an error in the List<BC_Atenci_n__c> atenciones parameter/argument. The analyzer doesn't recognize a custom object. The error message is "Invalid type: BC_Atenci_n__c" (where BC_Atenci_n__c is a custom object).

What can it be?

Thx

Trying to comply with PMD Code Analyzer I found that it doesn't recognize a custom object's name (BC_Atenci_n__c) anywhere in the code.


Solution

  • Finally, with the help of eyescream and some research, I could fix it by refreshing the sObject definitions

    Shift + Command + P refresh sobject definitions

    And I got what I needed.

    Thanks!