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

Modernize jetty-util-ajax #3385

Closed
sbordet opened this issue Feb 23, 2019 · 1 comment · Fixed by #4477
Closed

Modernize jetty-util-ajax #3385

sbordet opened this issue Feb 23, 2019 · 1 comment · Fixed by #4477

Comments

@sbordet
Copy link
Contributor

sbordet commented Feb 23, 2019

jetty-util-ajax should be modernized and use generics in various places where it does not.

@sbordet
Copy link
Contributor Author

sbordet commented Jan 14, 2020

Users of jetty-util-ajax had to suppress warnings in these cases:

  • Implementing JSON.Convertor:
public static class MyConvertor implements JSON.Convertor {
    ...
    @Override
    @SuppressWarnings("rawtypes")
    public Object fromJSON(Map map) {
        ...
    }
}

Same was happening when overriding few JSON methods such as Map newMap() (returning a raw Map), etc.

  • Historycally, the JSON class was supposed to be just a collection of static methods. But with the introduction of JSON.Convertor it holds a state, so its static usage was confusing because the static instance is accessible, can be passed around, but it's not properly synchronized, and at risk to be configured differently and unexpectedly by different parts of code.
    Therefore static methods are now deprecated and only instance methods are kept.

sbordet added a commit that referenced this issue Jan 14, 2020
Added type parameter to methods that were using raw types.
Updated the implementation to use generics.
Deprecated static methods.
Updated usages.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
sbordet added a commit that referenced this issue Jan 17, 2020
Removed deprecated methods as suggested in review.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
sbordet added a commit that referenced this issue Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant