Skip to content
Advertisement

Minecraft Spigot having problem with ImmutableList [closed]

in end of code is this error what problem? tried many fixes but no ones help https://i.stack.imgur.com/jwosT.png

Advertisement

Answer

return (List<String>) ImmutableList.of();

The problem with this is that the type of ImmutableList.of() is determined before the cast is applied.

The type of ImmutableList.of() in that context is ImmutableList<Object>. An ImmutableList<Object> isn’t an ImmutableList<String>.

I’m surprised you need any type hinting here:

return ImmutableList.of();
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement