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

Failing to properly codegen enums with certain IDs #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

namantash
Copy link

@namantash namantash commented Jun 3, 2018

Execution of codegen for

enum EnumCodeGenTest {
    NAME_1 = 1000
    NAME_2 = 10000
    NAME_2 = 102
}

Produces

public enum EnumCodeGenTest {
    NAME_2(102),NAME_1(1,000),NAME_2(10000); // won't compile
    private final static Map<Integer, EnumCodeGenTest> map = new HashMap<Integer, EnumCodeGenTest>();
    static {
        map.put(102, NAME_2);
        map.put(1,000, NAME_1);  // won't compile
        map.put(10000, NAME_2);
        }
    private final int value;
    private EnumCodeGenTest (int value) {
        this.value = value;
    }

    public int getValue(){ return value; }

    public static EnumCodeGenTest findByValue(int value) { return map.get(value); }
}

The PR should fix it. Please review.

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.

1 participant