Why is code that returns a genericized Map generating a compiler warning when assigned to a generic Map?

后端 未结 2 1623
庸人自扰
庸人自扰 2021-01-23 21:32

I have a method with this signature:

   protected final Map buildOutputMappings(
                                 AbstractDataObject ado, M         


        
2条回答
  •  盖世英雄少女心
    2021-01-23 21:40

    my guess is that you are not using generics correctly in the subclass, and the compiler is disabling generics for the class. thus the return type for the buildOutputMappings call is being converted to the raw type and the warning is being generated. is the parent class parameterized? does the subclass include types for the parent classes parameters?

    In short, your error is most likely a dropped type parameter somewhere in the subclass or parent class.

提交回复
热议问题