Given the following code:

——————————————————————————————————-
package rankspin

import groovy.transform.CompileStatic

trait SimpleMap<K, V> {
  abstract V getAt(K k)
}

class Foo implements SimpleMap<String, String> {
  String getAt(String k) {return "bar"}
}

@CompileStatic
void go(SimpleMap map) {
  println map["a"]
}

Foo foo = new Foo()
go(foo)
——————————————————————————————————-

I get the following exception:

Caught: groovy.lang.MissingPropertyException: No such property: a for class: 
rankspin.Foo
groovy.lang.MissingPropertyException: No such property: a for class: 
rankspin.Foo
        at rankspin.scratch$go.callCurrent(Unknown Source)
        at rankspin.scratch.run(scratch.groovy:19)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

If I take @CompileStatic out it works.  It seems that with compile static 
Groovy is not honoring the overloaded bracket operators with getAt and setAt.  
Am I missing something here?


Also,  in the actual code where this issue is occurring I get a:

Threw: org.codehaus.groovy.runtime.metaclass.MissingPropertyExceptionNoStack
msg: No such property: password for class: rankspin.web.MyRequest

With no stack trace.  Even in the example code above it does not indicate the 
code site where the error occurred.  is this correct?

Thanks!



Reply via email to