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

Jsoniter doesn't support Java 16 records #302

Open
knl opened this issue Sep 2, 2021 · 4 comments
Open

Jsoniter doesn't support Java 16 records #302

knl opened this issue Sep 2, 2021 · 4 comments

Comments

@knl
Copy link

knl commented Sep 2, 2021

When I try to deserialize a record, I get the following error:

com.jsoniter.spi.JsonException: no constructor for: class ch.knezevic.school.LastDone
	at ch.knezevic.school.FeedTest.shouldDecodeLastDone(FeedTest.java:67)

The test looks like this:

    private static final String SAMPLE_LAST_DONE_MESSAGE = """
        {
          "timestamp":0,
          "book":"book",
          "price":1000,
          "volume":10
        }
        """;

    @Test
    public void shouldDecodeLastDone()
    {
        final LastDone lastDone = JsonIterator.deserialize(SAMPLE_LAST_DONE_MESSAGE, LastDone.class);
        assertEquals("book", lastDone.book());
    }

LastDone is defined as:

public record LastDone(String book, int price, long volume, long timestamp)
{
}
@sergey-morenets
Copy link

Hi @knl

Since the last commit here was in 2019 I doubt that Json Iterator supports latest Java features like records, etc.

@knl
Copy link
Author

knl commented Nov 3, 2021

True that, I didn't take a look at the last commit. Is this a dead project then?

@sergey-morenets
Copy link

@knl Not sure but you can always ask authors of this libraries

@lnsandnkth
Copy link

lnsandnkth commented Feb 28, 2022

I am from a student group from kth stockholm, trying to solve this issue as a homework. Could you @taowen add me as an assignee?

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

3 participants