title: Closure with typed arguments in Groovy
body: <p>I'd like to be more explicit about my closures regarding their argument types.  So I would write something like</p>
  
  <pre><code>List&lt;Y&gt; myCollect(List&lt;X&gt; list, Closure&lt;X,Y&gt; clos) { ... }
  </code></pre>
  
  <p>I know that Groovy won't use that type information, but Groovy++ may use it at compile time.  Can this be be achieved (other than putting it into a comment)?</p>
  
  <p>UPDATE:
  The title may sound misleading, but I thought the above example would make it clearer.  I'm interested in specifying types of a closure which is the argument of some function.  Suppose, I want to redefince the built-in <code>collect</code>.  So I'm interested in writing <code>myCollect</code>, not in writing <code>clos</code>.  What I want to achieve is get compile time errors</p>
  
  <pre><code>myCollect(['a', 'ab'], { it / 2 }) // compile error
  myCollect(['a', 'ab'], { it.size() })  // OK 
  </code></pre>