illegal cyclic inheritance involving trait Iterable_2种解决方式

简介: illegal cyclic inheritance involving trait Iterable_2种解决方式

一、报错内容

/Users/liyangda/Code/DemoProject/demo-scala/src/scala/old04/T4.scala:11:20
illegal cyclic inheritance involving trait Iterable
    val value= List(1, 2, 3, 4, 5, 6, 7, 8)

二、问题解决

1、方式一:降低scala版本

可以选择降低Scala的版本,可以解决一定的问题。

2、更改maven打包配置

将maven打包的方式,改为Scala的打包方式,初始化创建的时候,都是maven的打包,也就是默认Java的,还是需要更换为Scala的打包方式。

<build>
    <finalName>SparkCoreTest</finalName>
    <plugins>
        <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <version>3.4.6</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
目录
打赏
0
0
0
0
35
分享
相关文章
|
4月前
|
组合模式(Composite Pattern)
组合模式是一种结构型设计模式,将对象组织成树形结构,表示“部分-整体”的层次关系,使客户端可以一致地处理单个对象和组合对象。适用于文件系统、组织架构等场景,具有高灵活性和扩展性,但会增加系统复杂性。
48 1
访问者模式问题之FunctionExtractor2 类中的 functions 列表该怎么被使用
访问者模式问题之FunctionExtractor2 类中的 functions 列表该怎么被使用
组合模式(Composite Pattern)
组合模式(Composite Pattern)是一种结构型设计模式。
96 0
1.3 Lambda表达式的基础:常用的函数式接口:Predicate、Consumer、Function等
1.3 Lambda表达式的基础:常用的函数式接口:Predicate、Consumer、Function等
102 0
装饰器模式(Decorator Pattern)
装饰器模式(Decorator Pattern)
128 0
装饰器模式(Decorator Pattern)
多重继承(Multiple Inheritance)
多重继承(Multiple Inheritance)
176 0
继承(Inheritance)
继承(Inheritance)
107 0
重构——67以委托取代继承(Replace Inheritance with Delegation)
以委托取代继承(Replace Inheritance with Delegation) 1、某个子类只使用了超类接口中的一部分,或是根本不需要继承而来的数据 2、在子类中新建一个字段用以保存超类;调整子类函数,令它改而委托超类;然后去掉两者之间的继承关系
2341 0
重构——68以继承取代委托(Replace Delegation with Inheritance)
以继承取代委托(Replace Delegation with Inheritance):你在两个类之间使用委托关系,并经常为整个接口编写许多极简单的委托关系;让委托类继承受托类
1202 0