Inner class methods are not suggested

Issue #2437 resolved
Stanisław Zań created an issue

I created a TestFactory class, and each sobject will be an inner class, with appropriate creation methods. When I want to use the class, the editor does not suggest any of the methods from the inner class, but when I type them manually, the code is formatted properly.

Inside the parameter’s brackets of .createPayment(), when I press Ctrl+P, the editor correctly shows the argument’s type and names.

Code:

@IsTest
public class COR_TestDataFactory {
    public class COR_PaymentFactory {
        public List<COR_Payment__c> createPayments(COR_Payment__c referenceRecord, Integer numberOfRecords, Boolean doInsert) {
            List<COR_Payment__c> objs = new List<COR_Payment__c>();
            for (Integer i = 0; i < numberOfRecords; i++) {
                COR_Payment__c obj = referenceRecord.clone();
                objs.add(obj);
            }

            if (doInsert) insert objs;
            return objs;
        }
        public List<COR_Payment__c> createPayments(Integer numberOfRecords, Boolean doInsert) {
            return createPayments(new COR_Payment__c(), numberOfRecords, doInsert);
        }
        public COR_Payment__c createPayment(COR_Payment__c referenceRecord, Boolean doInsert) {
            return createPayments(referenceRecord, 1, doInsert)[0];
        }
        public COR_Payment__c createPayment(Boolean doInsert) {
            return createPayments(new COR_Payment__c(), 1, doInsert)[0];
        }

    }


    public void foo() {

        new COR_TestDataFactory.COR_PaymentFactory().createPayment(new COR_Payment__c(),true);  //It's a valid line

        new COR_TestDataFactory.COR_PaymentFactory(). //It should suggest a methods from COR_PaymentFactory()


    }

}

Comments (3)

  1. Scott Wells repo owner

    Thanks for reporting. I’ve just committed a fix for the next build. The issue wasn’t so much around inner classes as around completions for members of types created via standalone new expressions, i.e., without a surrounding assignment context.

  2. Log in to comment