Cyclic inheritance when implementing inner interface in enum

后端 未结 3 1563
别那么骄傲
别那么骄傲 2020-12-14 14:16

I have the following implementation that gives a compiler error:

public enum FusionStat implements MonsterStatBuilderHelper {
    ATTACK {
        @Override
         


        
3条回答
  •  不思量自难忘°
    2020-12-14 15:15

    FusionStat is defined as implementing MonsterStatBuilderHelper, yet inside this enum you try to declare the interface MonsterStatBuilderHelper which extends MonsterStatBuilder.

    I suspect that what you want to do is simply define the method createBuilder() inside your enum.

    If you do actually want to define the MonsterStatBuilderHelper interface, this needs to be done outside the class/enum.

提交回复
热议问题