本文介绍了build.gradle文件,任务使用<<符号,intellij警告:“不能推断参数类型”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对groovy和gradle很陌生,想知道是否有人知道我的scriplet为什么不起作用(编辑它实际上工作,但警告仍然出现)。本节取自build.gradle脚本,intellij强调这一点,并抱怨:无法推断参数类型。任何帮助都不错:)

I'm new to groovy and gradle and was wondering whether someone knew why my scriplet wasn't working (edit actually it does work but the warning still appears). This section is taken out of the build.gradle script and intellij highlights this and complains that it: "Cannot infer argument types". any help would be nice :)

task hellofun << {
    [silly:'billy'].each { k, v ->
        println "$k=$v"
    }
}

编辑:我已提交,通知Intellij此问题

I have submitted a bug request informing Intellij of this problem

编辑:显然这是一个修正bug后,我会进行更新

apparently this is a known bug I'll update this once the bug is fixed

推荐答案

如果您愿意禁用Groovy> Assignment Issues>不兼容的类型分配检查,警告消失。

If you are willing to disable the Groovy > Assignment Issues > Incompatible type assignments inspection, the warning goes away.

这篇关于build.gradle文件,任务使用&lt;&lt;符号,intellij警告:“不能推断参数类型”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 16:02