uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: Generics in 2.8.0 getAllIndexedFS
Date Wed, 08 Jul 2015 21:10:02 GMT
I think I see another reason to allow type inferencing, which is less user code
starts failing to compile when adopting 2.8.0 from 2.7.0.  This is because user
code in 2.7.0 could have done:

FSIterator<MyAnnot> = myJCas.getJfsRepository().getAllIndexedFS(MyAnnot.type);

and it would work in 2.7.0 (because getAllIndexedFS(type) returned FSIterator 
(no generic info), which Java can assign to FSIterator<MyAnnot> with a warning.

But without type inference, and returning FSIterator<TOP>, I think this would
now be a hard failure, and user code that used to work would now start not
compiling. 

-Marshall

On 7/8/2015 3:47 PM, Marshall Schor wrote:
> OK.  Based on the previous discussion in this thread, and at least one other
> person posting their view in favor of type inferencing (vs. safety), I'm going
> to allow (3) to have type inference.
>
> -Marshall
>
> On 7/8/2015 11:17 AM, Richard Eckart de Castilho wrote:
>> On 08.07.2015, at 17:11, Marshall Schor <msa@schor.com> wrote:
>>
>>> I think that similar arguments apply to other getters, such as
>>>  getAnnotationIndex(some-type-spec).
>>>
>>> These are currently defined to be generic methods so they do type inferencing.
>> True. 
>>
>> Mind, I'm arguing for the conservative and safe choice here ( typically not my role
;) ).
>>
>> Back in the issue [1] I had first chosen a signature that allowed non-safe type inference
>> and you were cautious of that.
>>
>> But my feeling is that for the present case being cautious/conservative and in particular
safe is the better choice.
>>
>> Cheers,
>>
>> -- Richard
>>
>> [1] https://issues.apache.org/jira/browse/UIMA-4299?focusedCommentId=14487976&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14487976
>


Mime
View raw message