Groovy - MissingPropertyException in Class
<p>I am completely new to Groovy and having some trouble just getting this program running. All I'm trying to do is add all the elements of one list into another, but I can't even access the variable I want in the method.</p>

<p>I looked around here for an answer, but all seemed to be just too specific to a person's problem or too technical for my limited understanding of Groovy. Any help is appreciated.</p>

<p>Using <code>Groovy 2.4.5</code> in IntelliJ IDEA if that makes a difference. Here is the code I am trying to run: </p>

<pre><code>class ListPractice implements Testable {

    def mylist = [4,5,6]

    /**
     * Adds a set of elements to the mylist variable
     *
     * @paraelts The elements to be added
     */
    def addToList(List elts) {
        myList.each{
            println "I: $it"
        }
    }

    @Override
    void testMe() {
        addToList([7,8,9])
    }
}
</code></pre>

<p>But it throws the following error:</p>

<pre><code>Caught: groovy.lang.MissingPropertyException: No such property: myList
for class: ListPractice
Possible solutions: mylist
    groovy.lang.MissingPropertyException: No such property: myList for class: ListPractice
Possible solutions: mylist
    at ListPractice.addToList(ListPractice.groovy:14)
    at ListPractice$addToList.callCurrent(Unknown Source)
    at ListPractice.testMe(ListPractice.groovy:36)
    at Testable$testMe.call(Unknown Source)
    at RunMe$_main_closure1.doCall(RunMe.groovy:12)
    at RunMe.main(RunMe.groovy:11)
</code></pre>

<p>Since this is my first time using the language and the structure of the code was done by my teacher, I'm not even sure if <code>@Override</code> is necessary or what it does. </p>