groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: Lack of a wild card in DefaultGroovyMethods
Date Tue, 09 Jan 2018 12:26:37 GMT
Nathan created this issue wrt this topic:
https://issues.apache.org/jira/browse/GROOVY-8425
And there was also an existing related one:
https://issues.apache.org/jira/browse/GROOVY-8309

PRs with tests welcome. :-)

Cheers, Paul.


On Tue, Jan 9, 2018 at 10:09 PM, Алексей Афанасьев <megabochka@gmail.com>
wrote:

> It would be great to rework signatures of DGM with wildcards. It should
> fix a lot of stupid compile errors with @ComileStatic and will definitely
> improve Groovy support in IDE's.
>
> Alexey Afanasiev.
>
>
> 2017-12-27 15:28 GMT+03:00 Jochen Theodorou <blackdrag@gmx.org>:
>
>> On 27.12.2017 03:11, Nathan Harvey wrote:
>>
>>> A few methods in DefaultGroovyMethods don't utilize wildcards, for
>>> example,
>>> the Map plus operator:
>>>
>>> public static <K, V> Map<K, V> plus(Map<K, V> left, Map<K,
V> right) {
>>> ... }
>>>
>>> Which causes a compile error on the following, for example:
>>>
>>> Map<String, Object> map = [:]
>>> map + [hello: 'world']
>>>
>>> A few other methods might suffer from this problem. Does anyone have
>>> anything against changing them to support wildcards? eg: plus(Map<K, V>
>>> left, Map<? extends K, ? extends V> right)
>>>
>>
>> spontaneously I would say you are right... The problem with generics is
>> that they always require 2-3 steps extra, you tend to not to see right
>> away. So I assume this has been very much overlooked
>>
>> bye Jochen
>>
>
>

Mime
View raw message