Incorrect error highlighting

Issue #1800 new
Phil Weighill-Smith created an issue

I have a class SirenumUtils that contains the following nested interface (which has some specific implementations also in that class):

    public interface FieldSetMember {
        Boolean getDBRequired();
        String getFieldPath();
        String getLabel();
        Boolean getRequired();
        Schema.DisplayType getType();
    }

This is designed to mimic the Schema.FieldSetMember API to allow mocking.

I then have the following in a method of SirenumUtils:

    public static List<SirenumUtils.FieldSetMember> getFieldSet(Schema.DescribeSObjectResult objectType,
            String fieldSetName) {
        if (Test.isRunningTest()) {
            ...
        } else {
            // This is how the method is intended to work in production. The field set member list is underpinned
            // by real field set content
            Schema.FieldSet fieldSet = objectType.fieldSets.getMap().get(fieldSetName);

            if (fieldSet == null && !fieldSetName.contains('__')) {
                // Could not find the field set using the bare name (which doesn't have a namespace prefix
                // on it already), instead try to retrieve the field set with the extension package namespace
                fieldSet = objectType.fieldSets.getMap().get('s5m__' + fieldSetName);
            }

            if (fieldSet == null && !fieldSetName.contains('__') && String.isNotBlank(getNamespacePrefix())) {
                // Could not find the field set using the bare name (which doesn't have a namespace prefix
                // on it already) or on an s5m externally packaged field set. The org has a namespace so see if the
                // field set can be obtained by prefixing the name with the namespace prefix
                fieldSet = objectType.fieldSets.getMap().get(getNamespacePrefix() + fieldSetName);
            }

            if (fieldSet != null) {
                List<SirenumUtils.FieldSetMember> fieldSetResult = new List<SirenumUtils.FieldSetMember>();

                for (Schema.FieldSetMember member : fieldSet.fields) {
                    fieldSetResult.add(new FieldSetMemberBasedFieldSetMember(member));
                }

                return fieldSetResult;
            } else {
                return null;
            }
        }
    }

IC2 expresses the following error:

Expected type sirenum.SirenumUtils.FieldSetMember; found Schema.FieldSetMember

The editor shows:

Salesforce does not have any problem with the code.

Comments (1)

  1. Scott Wells repo owner

    I'll take a look at this one as well. The namespace qualifications should make this one unambiguous so I'm not sure what might be happening.

  2. Log in to comment