脚本运行器错误 'Failed type checking'
Script Runner Error 'Failed type checking'
我正在尝试使用脚本运行器来检查我的脚本是否有任何 error/deprecated 类。但是对于一些文件简单地说了以下错误:
Failed type checking and we don't know why, it's our fault not yours @ line 1, column 1.
我已将问题隔离为以下几点:
Map tmprc = issue.getCustomFieldValue(rcObj) as Map
if (tmprc) {
// Root Cause Category field defined but ensure both parts of its cascading field are selected
rotCausEntered = ((tmprc.get(null) != null) && (tmprc.get("1") != null))
}
特别是以下导致错误的代码
(tmprc.get(null) != null)
只是好奇是否有人知道为什么这段代码会导致错误。如果我评论这条线,一切正常。
这在类型检查场景中会失败是有道理的,因为 null
不是类型,并且您将它传递给需要 [=12= 的函数 get()
] 类型参数。例如,如果您 运行 null instanceof Object
,它 returns false
。类型检查器可能不知道如何处理并返回您看到的错误。
为什么要使用 null
作为 Map
中的键?改变这种行为可能是您的解决方案。
我正在尝试使用脚本运行器来检查我的脚本是否有任何 error/deprecated 类。但是对于一些文件简单地说了以下错误:
Failed type checking and we don't know why, it's our fault not yours @ line 1, column 1.
我已将问题隔离为以下几点:
Map tmprc = issue.getCustomFieldValue(rcObj) as Map
if (tmprc) {
// Root Cause Category field defined but ensure both parts of its cascading field are selected
rotCausEntered = ((tmprc.get(null) != null) && (tmprc.get("1") != null))
}
特别是以下导致错误的代码
(tmprc.get(null) != null)
只是好奇是否有人知道为什么这段代码会导致错误。如果我评论这条线,一切正常。
这在类型检查场景中会失败是有道理的,因为 null
不是类型,并且您将它传递给需要 [=12= 的函数 get()
] 类型参数。例如,如果您 运行 null instanceof Object
,它 returns false
。类型检查器可能不知道如何处理并返回您看到的错误。
为什么要使用 null
作为 Map
中的键?改变这种行为可能是您的解决方案。