Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spotbug与Kotlin兼容吗?_Kotlin_Spotbugs - Fatal编程技术网

Spotbug与Kotlin兼容吗?

Spotbug与Kotlin兼容吗?,kotlin,spotbugs,Kotlin,Spotbugs,在Kolin项目上运行spotbugs时,我会遇到以下错误: data class CSVRecord(private val columns: SortedSet<CSVColumn>) : Iterable<String> { override fun iterator(): Iterator<String> { return columns.map { it.value }.iterator() } } [ERROR]

在Kolin项目上运行spotbugs时,我会遇到以下错误:

data class CSVRecord(private val columns: SortedSet<CSVColumn>) : Iterable<String> {

    override fun iterator(): Iterator<String> {
        return columns.map { it.value }.iterator()
    }
}
[ERROR]私有方法com.example.CSVRecord.component1()在CSVRecord.kt UPM_UNCALLED_Private_方法中从未调用过[com.example.CSVRecord]

关于课程,例如:

data class CSVRecord(private val columns: SortedSet<CSVColumn>) : Iterable<String> {

    override fun iterator(): Iterator<String> {
        return columns.map { it.value }.iterator()
    }
}
数据类CSVRecord(专用val列:SortedSet):可编辑{
重写有趣的迭代器():迭代器{
返回columns.map{it.value}.iterator()
}
}
我不太清楚
组件1
来自哪里

根据文件:

编译器自动从所有 在主构造函数中声明的属性:

  • 等于()/hashCode()对
  • “User(name=John,age=42)”形式的toString()
  • 按声明顺序与属性对应的componentN()函数
  • copy()函数(见下文)
这是数据类的特征之一。自动生成的
组件n
函数允许您在此类类上使用:

data class Result(val result: Int, val status: Status)
fun function(...): Result {
    // computations

    return Result(result, status)
}

// Now, to use this function:
val (result, status) = function(...)