Incorrect SOQL/standard object fields handling

Issue #1799 new
Phil Weighill-Smith created an issue

I have the following query:

List<Site> sites = [SELECT Subdomain, UrlPathPrefix FROM Site WHERE Name LIKE '%Some%Value%' LIMIT 1]; // CRUD/FLS False Positive: This data is not displayed to the user.

This is followed by:

if (!sites.isEmpty()) {
    Organization org = [SELECT InstanceName, IsSandbox, OrganizationType FROM Organization]; // CRUD/FLS False Positive: This data is not displayed to the user.

    siteURL = 'https://' + sites[0].Subdomain + '.';
    siteURL += (org.IsSandbox || org.OrganizationType == 'Developer Edition' ?
            (org.InstanceName.toLowerCase() + '.') :
            '') +
            'force.com';

    if (String.isNotBlank(sites[0].UrlPathPrefix)) {
        siteURL += '/' + sites[0].UrlPathPrefix;
    }
} else {
    // Could not determine the site's URL. Give up quietly but in such a way that a repeat call
    // to this method in the current session will not perform any further queries
    siteURL = '';
}

I see the following errors reported by IC2:

Cannot resolve symbol 'Subdomain'

Cannot resolve symbol 'UrlPathPrefix'

Cannot resolve symbol 'UrlPathPrefix'

The editor shows:

Salesforce does not have any problem with this code.

Comments (1)

  1. Scott Wells repo owner

    I believe this is the same issue as #1627 where the name Location is ambiguous because it occurs as an SObject in the implicit Schema namespace and as an Apex type in the implicit System namespace. I was actually going to work on that this week.

  2. Log in to comment