Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support @CompileTimeConstant for enum fields. #3887

Closed
wants to merge 0 commits into from

Conversation

copybara-service[bot]
Copy link
Contributor

Support @CompileTimeConstant for enum fields.

The support for class fields was introduced in unknown commit. This CL merely extends it to enum fields, considering the similarity between them. There is also a feature request b/149290598 filed a few years back.

Specifically, this CL aims to support the following use case (taken from b/149290598):

public class Example {

  public enum ExampleEnum {
    A("a"), B("b");

    @CompileTimeConstant final String s;

    ExampleEnum(@CompileTimeConstant final String s) {
      this.s = s;
    }

    void invokeCtcMethod() {
      ctcMethod(s);
    }

    private void ctcMethod(@CompileTimeConstant String string) {}
  }
}

@copybara-service copybara-service bot closed this May 3, 2023
@copybara-service copybara-service bot deleted the test_528934120 branch May 3, 2023 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

0 participants