Code inspector false positive - "class unexpected" , "@ expected, got }"

Issue #2042 duplicate
Eric Kintzer created an issue

This is a weird one …

Generates code inspector error in line 5 (end of interface definition) and line 9 (start of inner class declaration); compiles fine

public inherited sharing class UUID_IC2 {

    public interface IBar {
        String foo();
    }

    static final String x = 'a';

    class Concrete implements IBar {

        public String foo() {
            return '';
        }
    }
}

By moving the static String higher in the code (above the interface declaration), no code inspection errors

public inherited sharing class UUID_IC2 {

    static final String x = 'a';
    public interface IBar {
        String foo();
    }

    class Concrete implements IBar {

        public String foo() {
            return '';
        }
    }
}

Comments (3)

  1. Scott Wells repo owner

    Yeah, this is a strange one that has to do with IC2's Apex parser's pinning and recovery logic. I'd actually had this one teed up for more investigation next week. Let's follow along over on #1992.

  2. Log in to comment