Method name "of" results in error despite being valid

Issue #904 resolved
Jon Wu created an issue

I have some static lookup methods called of, and IC complains with the following: '.', <, <name identifier> or '[' expected, got 'of'. This also breaks auto code formatting.

This code is valid and deploys without problems.

If you rename the method to ofX or anything but of, all is well within the editor, but that should not be necessary.

Example:

public class TestClass {
    public static Account of(String email) {
        return null;
    }
}

Comments (4)

  1. Jon Wu reporter

    Ah this is good to know! Thanks for the reference. Indeed it'd be great if you could ease the restriction since it works as of now. Perhaps the most ideal would be if it could be a warning for the future reserved words. Not sure if you can do different rules by API version or if you'd ever want to, but the neatest implementation would know what keywords would be valid depending on the class' API version.

  2. Log in to comment