Skip to content

Instantly share code, notes, and snippets.

@robfletcher
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robfletcher/44b115286fd9ef9c8a8c to your computer and use it in GitHub Desktop.
Save robfletcher/44b115286fd9ef9c8a8c to your computer and use it in GitHub Desktop.
Difference in static & dynamic code dispatching to field or getter
import groovy.transform.*
//@CompileStatic
class Person {
String name
private List<Person> friends
String friendNames() {
friends.collect { it.name }.join(", ")
}
}
assert new Person(name: "Rob").friendNames() == ""
@lhotari
Copy link

lhotari commented Dec 12, 2014

I think I've run in to this and reported a bug. I'll try to look it up.

@lhotari
Copy link

lhotari commented Dec 12, 2014

My problem was different indeed, it was http://jira.codehaus.org/browse/GROOVY-7098 . Fixed in 2.3.8 already .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment