I just had this error. The solution was I forgot that I was iterating over an ArrayList to access an object and needed to use dot notation to access the method I wanted to use. I was treating the object like a primary.