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

4 comments
Comment actions Permalink

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.

0
Comment actions Permalink

That sounds good.

Thank you.

Will this appear in this week's update, or next's?

Randall Schulz

0
Comment actions Permalink

That sounds good.

I would put it stronger, it is extremely cool:)


Thank you.

Will this appear in this week's update, or next's?

This one.


Randall Schulz


Eugene.

0
Comment actions Permalink

Already available.

0

Please sign in to leave a comment.