Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Code Block
import java.lang.reflect.Method
Iterable<Method> methods = String.methods.grep{'get') }
assert == [ "getBytes", "getBytes", "getBytes", "getBytes", "getChars", "getClass" ]

Implementation note: Java's generics implementation incorporates a feature known as "type erasure" which "throws away" generic type information after completing static type checking. This allows Java to easily integrate with legacy "non-generics" libraries. Groovy currently does a little further and throws away generics information "at the source level". Generics information is kept within signatures where appropriate (see for example the method foo below within class D).