无法将Kotlin“声明平台类型”警告转为错误

时间:2016-11-13 22:45:12

标签: intellij-idea kotlin

我有一个简单的Kotlin函数,它调用了一些Java代码:

fun simpleSchema(field: GraphQLFieldDefinition) =
    newSchema()
        .query(newObject()
            .name("root")
            .field(field)
            .build())
        .build()

在我的IDEA中,即

IntelliJ IDEA 2016.2.5
Build #IU-162.2228.15, built on October 14, 2016
JRE: 1.8.0_112-release-287-b2 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

有一条有用的信息:

Declaration has platform type. Make the type explicit to prevent subtle bugs.
This inspection reports functions and properties that have platform type. 
In order to prevent unexpected errors, the type should be declared explicitly.

这很棒。但是在编辑器窗格的RHS上,此消息被标记为弱警告,我希望它是一个错误。我去设置 - >编辑 - >检查 - > Kotlin - > “功能或属性具有平台类型”并将其标记为错误。

为什么这不起作用?在检查中搜索“平台类型”显示没有比上述更可能的候选人。我重新启动并使缓存无效......

Code in question Tooltip for Alt-Enter

0 个答案:

没有答案