Christopher Smith created GROOVY-10157:
------------------------------------------

             Summary: STC can't find method reference for property with 
annotation
                 Key: GROOVY-10157
                 URL: https://issues.apache.org/jira/browse/GROOVY-10157
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 3.0.8
            Reporter: Christopher Smith


I am having difficulty reducing this to a minimal example, but it seems (1) 
reliably reproducible with groovyc and (2) intermittent(?) with GRECLIPSE.

Method references (with {{.&}}) to getters are inconsistently producing errors 
of the form
{code}
Cannot find matching method com.example.IdentityRecord#getEmail.
{code}
The property in question is defined simply as {{String email}}, and {{javap}} 
produces the entirely mundane

{code}
  public java.lang.String getEmail();
    Code:
       0: aload_0
       1: getfield      #94                 // Field email:Ljava/lang/String;
       4: areturn
{code}

What is baffling me is that this does not occur on all properties. The 
properties on which it appears are ones where I have JSR-303 annotations (i.e., 
markers but nothing that triggers an ASTT), but the error persists _even after 
commenting the annotation and its import_, both in groovyc and GRECLIPSE. 
Identical properties without annotations never trigger the error.

It _appears_ that the error only appears when both the POGO and the class 
trying to define a method reference on it are in the compilation unit; in 
Eclipse only, explicitly compiling the record class and then triggering a 
recompile by saving the service class works, but doing a project clean and 
rebuild produces the error.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to