Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30381 > unrolled thread

Generic return types

Started byRoedy Green <see_website@mindprod.com.invalid>
First post2014-11-21 13:22 -0800
Last post2014-11-23 05:27 -0800
Articles 4 — 3 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Generic return types Roedy Green <see_website@mindprod.com.invalid> - 2014-11-21 13:22 -0800
    Re: Generic return types Arne Vajhøj <arne@vajhoej.dk> - 2014-11-21 17:31 -0500
      Re: Generic return types Tassilo Horn <tsdh@gnu.org> - 2014-11-22 14:54 +0100
        Re: Generic return types Roedy Green <see_website@mindprod.com.invalid> - 2014-11-23 05:27 -0800

#30381 — Generic return types

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-11-21 13:22 -0800
SubjectGeneric return types
Message-ID<05bv6a9l6ja7g57s6oo7o0o2s923f6li8c@4ax.com>
I wrote some code like this

 Iterable<File> allFiles() ...

The IntelliJ lint complained about this saying I should not be using
generics in the return type.

Is that correct? If so, why?
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Software gets slower faster than hardware gets faster.
~ Niklaus Wirth (born: 1934-02-15 age: 80) Wirth’s Law

[toc] | [next] | [standalone]


#30382

FromArne Vajhøj <arne@vajhoej.dk>
Date2014-11-21 17:31 -0500
Message-ID<546fbd53$0$304$14726298@news.sunsite.dk>
In reply to#30381
On 11/21/2014 4:22 PM, Roedy Green wrote:
> I wrote some code like this
>
>   Iterable<File> allFiles() ...
>
> The IntelliJ lint complained about this saying I should not be using
> generics in the return type.
>
> Is that correct? If so, why?

I don't think so.

I can not see the justification for such a rule.

And there are lots of methods in java.util
classes that use generics in return types.
So apparently SUN/Oracle is not convinced either.

Arne

[toc] | [prev] | [next] | [standalone]


#30386

FromTassilo Horn <tsdh@gnu.org>
Date2014-11-22 14:54 +0100
Message-ID<87389bxrvw.fsf@thinkpad-t440p.tsdh.org>
In reply to#30382
Arne Vajhøj <arne@vajhoej.dk> writes:

>> I wrote some code like this
>>
>>   Iterable<File> allFiles() ...
>>
>> The IntelliJ lint complained about this saying I should not be using
>> generics in the return type.
>>
>> Is that correct? If so, why?
>
> I don't think so.
>
> I can not see the justification for such a rule.
>
> And there are lots of methods in java.util
> classes that use generics in return types.
> So apparently SUN/Oracle is not convinced either.

Just a blind guess but maybe Roedy has set the source compatibility
level to java 1.4?  Well, that shouldn't only affect generic return
types but all usages of generics...

Bye,
Tassilo

[toc] | [prev] | [next] | [standalone]


#30388

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-11-23 05:27 -0800
Message-ID<o5o37a9fgkqh6mb5g63vufgoe89nid7qn9@4ax.com>
In reply to#30386
On Sat, 22 Nov 2014 14:54:27 +0100, Tassilo Horn <tsdh@gnu.org> wrote,
quoted or indirectly quoted someone who said :

>
>Just a blind guess but maybe Roedy has set the source compatibility
>level to java 1.4?  Well, that shouldn't only affect generic return
>types but all usages of generics...

It is set at  1.7.  I guess I will have to create SSCCE and show it to
IntelliJ. It compiles and executes fine. It is just the lint.  I can't
think of a reason why that would be poor form.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Software gets slower faster than hardware gets faster.
~ Niklaus Wirth (born: 1934-02-15 age: 80) Wirth’s Law

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web