Generic class with abstract class

I have been going through a java class on udemy and using Iodine to look at code provided and this line is causing issues with Iodine and I think its a bug. (But knowing my luck I copied and pasted wrong from their intellij project.)

Snippet

public class Team<T extends Player> implements Comparable<Team<T>>

It says greater or comma expected and got extends

I was able to run it in Visual Studio Code which is why I suspect bug. If you'd like to look at their  original project to get context. I uploaded it here: https://1drv.ms/u/s!As9_DOw2lFm8iK4KCti8IGow2PEPOg?e=rOlcCy

Here's the full code for the class:

    import java.util.ArrayList;


public class Team<T extends Player> implements Comparable<Team<T>>
{
    private String name;
    int played = 0;
    int won = 0;
    int lost = 0;
    int tied = 0;

    private ArrayList<T> members = new ArrayList<>();

    public Team(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return name;
    }

    public boolean addPlayer(T player)
    {
        if (members.contains(player))
        {
            System.out.println(player.getName() + " is already on this team");
            return false;
        } else
        {
            members.add(player);
            System.out.println(player.getName() + " picked for team " + this.name);
            return true;
        }
    }

    public int numPlayers()
    {
        return this.members.size();
    }

    public void matchResult(Team<T> opponent, int ourScore, int theirScore)
    {

        String message;

        if (ourScore > theirScore)
        {
            won++;
            message = " beat ";
        } 
		else if (ourScore == theirScore)
        {
            tied++;
            message = " drew with ";

        } 
		else
        {
            lost++;
            message = " lost to ";
        }
        played++;
        if (opponent != null)
        {
            System.out.println(this.getName() + message + opponent.getName());
            opponent.matchResult(null, theirScore, ourScore);
        }
    }

    public int ranking()
    {
        return (won * 2) + tied;
    }

    @Override
    public int compareTo(Team<T> team)
    {
        if (this.ranking() > team.ranking())
        {
            return -1;
        } 
		else if (this.ranking() < team.ranking())
        {
            return 1;
        } 
		else
        {
            return 0;
        }
    }
}

Thanks, logged as bugs://85835

bugs://85835 got closed with status fixed.

1 Like