So a barebones example of what I have you can see below. This is what the compiler is telling me:
error: incompatible types
for (PluginSnapshot snapshot : this.platform.getPlugins()) {
^
required: PluginSnapshot
found: Object
This error makes no sense because the type is specified as PluginSnapshot
. Any ideas why this could be happening? The issue can be recreated with the following code.
public class Main {
public static void main(String... args) {
Platform platform = null;
for (PluginSnapshot plugin : platform.getPlugins()) {
// ...
}
}
}
public interface Platform<P extends Player> {
List<P> getPlayers();
List<PluginSnapshot> getPlugins();
}
public interface Player {
UUID getUniqueId();
}
public interface PluginSnapshot {
String name();
}