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

@JsonCreator not working on a factory with no arguments for ae enum type #960

Closed
ajonkisz opened this issue Oct 6, 2015 · 1 comment
Closed
Milestone

Comments

@ajonkisz
Copy link

ajonkisz commented Oct 6, 2015

Using a singleton pattern as described here by Joshua Block results in IllegalArgumentException from BasicDeserializerFactory:1252. An example:

public enum  MyEnum {
    INSTANCE;

    @JsonCreator
    public static MyEnum getInstance() {
        return INSTANCE;
    }   
}

A dirty workaround is to add an ignored parameter like:

@JsonCreator
public static MyEnum getInstance(String ignored) {
    return INSTANCE;
}

This issue is related to issue 929

@cowtowncoder
Copy link
Member

Yes, I think it is essentially a variation of #929. Thank you for reporting this.

cowtowncoder added a commit that referenced this issue May 5, 2016
@cowtowncoder cowtowncoder added this to the 2.8.0 milestone May 5, 2016
@cowtowncoder cowtowncoder changed the title @JsonCreator not working on a factory with no arguments for a enum type @JsonCreator not working on a factory with no arguments for ae enum type May 5, 2016
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

No branches or pull requests

2 participants