6
我剛剛將一個Grails應用程序升級到使用Groovy 2.0的2.2.0,現在我正在編譯錯誤:基於以下代碼將同名的私有和公共/受保護方法混合導致多方法被禁用並且被禁止以避免出乎意料的行爲
Mixing private and public/protected methods of the same name causes multimethods to be disabled and is forbidden to avoid surprising behaviour. Renaming the private methods will solve the problem.
:
def getRootDomain(key) { }
private getRootDomain() { }
這是一個簡單的辦法,但我真的想了解爲什麼好。誰可以給我解釋一下這個?
我還沒有見過。謝謝。 – Gregg