0

我有一个带有 scala 和 java 的项目。对于 scala 编译,使用了 scala-maven-plugin。

所以在构建过程中会有一些这样的消息:

[INFO] --- scala-maven-plugin:3.1.6:testCompile (scala-test-compile) @ project_name ---
...    
[ERROR] Nothing <: com.some.SomeType?
[INFO] true
...

这是什么意思?scala类的来源如下:

package com.some

package object model {

  type SomeType = List[String]

  object SomeType {
    def apply(msg: String): SomeType = List(msg)
  }

  type SecondType[I] = AnyRef {
    def id: I
    def version: Long
  }

  type AnotherSecondType = SecondType[Another] {
    def id: Another
    def version: Long
  }

}

PS此外,对于其他 scala 类,还有其他此类消息对。

更新的 Maven 构建成功完成,但我在日志中有这些消息。

4

1 回答 1

0

这看起来像您已-explaintypes在 Scala 编译器选项中启用。打开你的pom.xml并检查<plugin><plugins>条目scala-maven-scala。看看<configuration><args>你有没有<arg>-explaintypes</arg>。这些消息有时可以帮助清理代码中的类型错误,但我发现它们太烦人了,不能一直保持它们。

于 2014-06-30T19:19:23.673 回答