title: Groovy constructors
body: <p>I'm having a problem while using constructors with a Groovy class.</p>
  
  <p>I have a class <code>Data</code> in a file called <code>Data.groovy</code> with an inner class <code>ContentEntry</code>. I want to initialize <code>ContentEntry</code> instances from a <code>Data</code> method:</p>
  
  <pre><code>static void initContent(nid, uid)
  {
      curContent = new ContentEntry()
      curContent.nid = nid;
      curContent.uid = uid;
  }
  </code></pre>
  
  <p>with <code>ContentEntry</code> defined as:</p>
  
  <pre><code>class ContentEntry
  {
      public int nid, uid 
      private tags = [:]
  
      public ContentEntry()
      {
  
      }
  
      ContentEntry(int nid, int uid)
      {
          this.nid = nid
          this.uid = uid
      }
  
      //omitted rest of the class
  </code></pre>
  
  <p>But when running the project it gives me the following error:</p>
  
  <pre><code>Exception in thread "main" org.codehaus.groovy.runtime.metaclass.MethodSelectionException:
  Could not find which method &lt;init&gt;() to invoke from this list:
  public it.softit.Data$ContentEntry#&lt;init&gt;(it.softit.Data, int, int)
  public it.softit.Data$ContentEntry#&lt;init&gt;(it.softit.Data)
  </code></pre>
  
  <p>It's like if constructors implicitly need an instance of the outer class passed as a parameter. I'm wondering why..</p>