eclipse-lsp4j / lsp4j

A Java implementation of the language server protocol intended to be consumed by tools and language servers implemented in Java.
https://eclipse.org/lsp4j
Other
613 stars 145 forks source link

TypeAdapter(Factories) dont check passed (token) type #623

Open cdietrich opened 2 years ago

cdietrich commented 2 years ago

our TypeAdapter(Factories) dont check if the (token) type passed into public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { matches the type the adapter is for.

when testing with

GsonBuilder builder = new GsonBuilder();
        builder.registerTypeAdapterFactory(new RestartArgumentsTypeAdapterFactory());
        Gson gson = builder.create();
        XXXX object = gson.fromJson("{\"noDebug\":true}", ELEMENT_TYPE.getType());

this may lead to stackoverflows