meilisearch-java icon indicating copy to clipboard operation
meilisearch-java copied to clipboard

Type safety Warning on `Result` class

Open alallema opened this issue 2 years ago • 4 comments

Description Type safety is not applied when decoding the Result class throught the JSON handler in the method getKeys() and getTasks()

        Result<Key> result = httpClient.get(urlPath, Result.class, Key.class);
        Result<Task> result = httpClient.get(urlPath, Result.class, Task.class);

This warning is thrown: Type safety: The expression of type Result needs unchecked conversion to conform to Result<Key>Java(16777748)

Notes This issue should be implemented before the resolution of #420

alallema avatar Oct 27 '22 15:10 alallema

Hi Can I contribute trying t debug this?

ancatoza avatar Mar 09 '23 22:03 ancatoza

Hi @ancatoza, Yes of course with pleasure 😊

alallema avatar Mar 13 '23 10:03 alallema

hi :) I'll start working on this issue inmediately, can you please confirm that the following path is the correct one? meilisearch-java/src/main/java/com/meilisearch/sdk/model/Results.java

ancatoza avatar Mar 24 '23 21:03 ancatoza

As stated in the issue, the warning is displayed in these two classes:

in the method getKeys() and getTasks()

So respectively, in the files TasksHandler.java and KeysHandler.java. But I'm pretty sure the main problem comes with how types are processed in the JsonHandler from decode method.

alallema avatar Mar 27 '23 10:03 alallema