Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Unexpected type required class found type parameter Attack"

this is my code (trying to write a copy constructor for my class):

public class ArgumentTree<GameArgument, Attack> extends DelegateTree<GameArgument, Attack>
{
    public ArgumentTree()
    {super();}

    public ArgumentTree(ArgumentTree<GameArgument, Attack> sourceTree)
    {
        super();
        Attack atck = new Attack(); // I get the Error here
        more code....
    }
}

I am getting this error:

unexpected type  
 required: class  
 found:   type parameter Attack  

just to clarify: I don't want to make the code generic. I already know that the types I will use will be only GameArgument and Attack. Also, Attack has its own proper default constructor.

like image 297
Ali Avatar asked Jun 22 '26 03:06

Ali


1 Answers

You are using actual class names as type variables. This doesn't make sense. Maybe you want something like

public class ArgumentTree extends DelegateTree<GameArgument, Attack>
like image 57
Marko Topolnik Avatar answered Jun 23 '26 16:06

Marko Topolnik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!