我正在尝试使用模型数据制作可扩展的回收器视图。但我收到签名错误。尝试了不同的解决方案但没有奏效。如何将 JvmName 设置为构造函数?
错误: 平台声明冲突:以下声明具有相同的 JVM 签名 ((ILjava/util/List;Z)V):
行模型类:
class RowModel {
companion object{
@IntDef(WEB_MENU, CHILD, CHILDX, CHILDXX)
@Retention(AnnotationRetention.SOURCE)
annotation class RowType
const val WEB_MENU = 1
const val CHILD = 2
const val CHILDX = 3
const val CHILDXX = 4
}
@RowType var type : Int
lateinit var webMenuItem : List<WebMenuItem>
lateinit var child: List<Child>
lateinit var childX: List<ChildX>
lateinit var childXX: List<ChildXX>
var isExpanded : Boolean
constructor (@RowType type : Int, webMenuItem: List<WebMenuItem>, isExpanded : Boolean = false){
this.type = type
this.webMenuItem = webMenuItem
this.isExpanded = isExpanded
}
constructor(@RowType type : Int, child: List<Child>, isExpanded : Boolean = false){
this.type = type
this.child = child
this.isExpanded = isExpanded
}
constructor(@RowType type : Int, childX: List<ChildX>, isExpanded : Boolean = false){
this.type = type
this.childX = childX
this.isExpanded = isExpanded
}
constructor(@RowType type : Int, childXX: List<ChildXX>, isExpanded : Boolean = false){
this.type = type
this.childXX = childXX
this.isExpanded = isExpanded
}
}
webMenuItem 类:
class WebMenuItem {
val authFunctionTag: String = ""
val callFunctionName: Any = ""
val childs: MutableList<Child> = mutableListOf()
val id: Int = Int.MIN_VALUE
val isQueryWindow: Boolean = false
val menuIcon: String = ""
val menuName: String = ""
val queryServiceName: Any = ""
val queryTableName: Any = ""
val queryUniqColumnName: Any = ""
val queryUniqFieldName: Any = ""
val menuOrder: Int = ""
}
儿童班:
class Child{
val authFunctionTag: String = ""
val callFunctionName: String = ""
var childs: List<ChildX> = mutableListOf()
val id: Int = Int.MIN_VALUE
val isQueryWindow: Boolean = false
val menuIcon: String = ""
val menuName: String = ""
val menuOrder: Int = Int.MIN_VALUE
val queryServiceName: String = ""
val queryTableName: String = ""
val queryUniqColumnName: String = ""
val queryUniqFieldName: String = ""
}
ChildX 类:
class ChildX{
val authFunctionTag: String = ""
val callFunctionName: String = ""
var childs: List<ChildXX> = mutableListOf()
val id: Int = Int.MIN_VALUE
val isQueryWindow: Boolean = false
val menuIcon: String = ""
val menuName: String = ""
val menuOrder: Int = Int.MIN_VALUE
val queryServiceName: String = ""
val queryTableName: String = ""
val queryUniqColumnName: String = ""
val queryUniqFieldName: String = ""
}
ChildXX 类:
class ChildXX{
val authFunctionTag: String = ""
val callFunctionName: String = ""
var childs: List<Any> = mutableListOf()
val id: Int = Int.MIN_VALUE
val isQueryWindow: Boolean = false
val menuIcon: String = ""
val menuName: String = ""
val menuOrder: Int = Int.MIN_VALUE
val queryServiceName: String = ""
val queryTableName: String = ""
val queryUniqColumnName: String = ""
val queryUniqFieldName: String = ""
}