Pregunta

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.

¿Fue útil?

Solución

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.

Otros consejos

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. :)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top