title: How do I get a java.reflect.Field value for a property inherited from a Groovy trait?
body: <p>I'm using Groovy 2.4.3 inside of a Grails web application. I have the following Trait/Class hierarchy declared in it:</p>
  
  <pre><code>trait GuidData {
      String Guid
  }
  
  class Enrollment implements GuidData {
      String email
  }
  </code></pre>
  
  <p>When I execute the following code I get the expected results:</p>
  
  <pre><code>Enrollment enrollment = new Enrollment(email: "joe@tester.com", guid: "XXXX")
  assert enrollment.properties == ['email':'joe@tester.com', 'guid':'XXXX']
  assert enrollment.getProperty("guid") == "XXXX")
  Enrollment.getDeclaredField("email") == private java.lang.String Enrollment.email
  </code></pre>
  
  <p>But when I execute the method:</p>
  
  <pre><code>Enrollment.getDeclaredField("guid")
  </code></pre>
  
  <p>I get a NoSuchFieldException. If I execute a "getDeclaredMethod()" for the "getEmail" method, I correctly get a java.reflect.Method instance back.</p>
  
  <p>So ... it appears that Groovy properties defined in a trait show as Groovy properties and can be referenced like a property defined within the parent class, but they do NOT reflect as a field with getter/setters in the standard Groovy property pattern. In other words, if the property shows up in the instance call to the getProperties(), I would expect the reflection call to get the Field definition to work as well.</p>