Groovy - 没有返回类型的方法签名

ibe*_*rck 1 groovy

在 Groovy 中,有人可以向我解释为什么下面的代码尽管没有返回类型却不会失败吗?

protected assertRequired(String name, String tag, attrs) {
    if (!attrs.containsKey(name)) {
        throwTagError "Tag [$tag] is missing required attribute [$name]"
    }
    return attrs[name] // conserva la propiedad en attrs.
}
Run Code Online (Sandbox Code Playgroud)

zor*_*119 5

它确实有一个返回类型Object

protected ...相当于def protected ...,其返回类型为Object