Spurious "Cannot assign ..." Diagnostic
Hi,
I have this code in a Grail controller action closure:
allNameRefs = TauUtil.makeHashSet() ... NameRef[] allNameRefsA = allNameRefs.toArray(new NameRef[allNameRefs.size()]); ]]>
The entire call to allNameRefs.toArray is hilighted in dirty yellow and the diagnostic "Cannot assign T[] to tau.cl.CLIFCollectorXR.NameRef[]" is shown. All the requisite imports are present.
Clearly this code is fine in Java (which is where it originated, actually). Is it not OK in Groovy? It does actually run correctly and is not flagged as ereroneous or questionable in Java.
(Incidentally, TauUtil.makeHashSet() is a generic method no diagnostic is associated with that assignment, either in Groovy or in Java.)
Randall Schulz
请先登录再写评论。
Well, to make transition from java to groovy smooth, I have implemented the same generic methods type inference for groovy this week. So this should be OK in the next version.
That sounds good.
Thank you.
Will this appear in this week's update, or next's?
Randall Schulz
I would put it stronger, it is extremely cool:)
This one.
Eugene.
Already available.