如果未定义XYZ,grailsApplication.config.XYZ将返回什么?

如果未定义XYZ,grailsApplication.config.XYZ将返回什么?,grails,Grails,这里是Grails2.4.x。我正在浏览一个准遗留Grails应用程序的代码,看到了这个小宝石: public static boolean isFizz() { def isEnabled = isFizz if (isEnabled != true && isEnabled != false) { // Config is missing, so default to true return true

这里是Grails2.4.x。我正在浏览一个准遗留Grails应用程序的代码,看到了这个小宝石:

public static boolean isFizz() {
    def isEnabled = isFizz
    if (isEnabled != true && isEnabled != false) {
        // Config is missing, so default to true
        return true            
    }

    isEnabled
}
真的吗?这不应该是:

public static boolean isFizz() {
    def isEnabled = isFizz
    if (isEnabled == null) {
        // Config is missing, so default to true
        return true            
    }

    isEnabled
}

如果
config.groovy
中未定义
XYZ
,那么
grailsApplication.config.XYZ
返回什么?无效的还有别的吗

@user3718614是正确的。结果是一个空的
映射
->[:]


由于,空的
映射
计算结果为false。

我记得空映射将被返回。你可以用println测试它