質問

I'm using IntelliJ IDEA for a Grails Project. Running Grails 2.3.5. When using dirtyPropertyNames on a domain class, IntelliJ gives me a warning, "Cannot resolve symbol 'dirtyPropertyNames'"

Here is my code:

def getDirtyProperties(User user) {
    def dirtyProperties = user.dirtyPropertyNames
    return dirtyProperties
}

What is my problem here? Thank you.

役に立ちましたか?

解決

You need a smarter IDE :) The method is there, which you know because the code runs. It's added to the MetaClass, so it's not visible via reflection. IDEs have to have special handling for dynamic methods and apparently this one was missed.

他のヒント

Settings -> Inspections -> Groovy -> 
                           Probable bugs -> Access to Unresolved expression

Uncheck that and you should be good. I won't do it for the sake of only removing the inspections because I am not sure what the impact will be for other inspections. :)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top