Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37054
| From | Andreas Leitgeb <avl@logic.at> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: What's the best way to make a cross string set? |
| Date | 2017-08-03 14:33 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <slrnoo6d9a.o2q.avl@logic.at> (permalink) |
| References | (6 earlier) <f6d72507-62a9-4442-b7c9-cb47c9ed60fe@googlegroups.com> <3664ab4d-9619-43d0-9535-1ce7ab4d4438@googlegroups.com> <a107955f-5c2c-4e0e-8033-4009d7eb26fd@googlegroups.com> <slrnoo36mh.o2q.avl@logic.at> <ab4d1e2d-baae-488d-a6a3-9e0c31037c4d@googlegroups.com> |
Eric Douglas <e.d.programmer@gmail.com> wrote:
> On Wednesday, August 2, 2017 at 5:27:01 AM UTC-4, Andreas Leitgeb wrote:
>> Are you sure that you had to change it? The <?> could be just fine
>> in many cases. It just means that the generics class itself doesn't
>> give a dime about it's parameter type or any restrictions on it.
>> It's certainly *not* just eclipse saying "dunno".
> Yes, for instance I have a method declared as
> protected Comparable<Object> getCompareValue() {
> I call this method from
> final Comparable compareMe = getCompareValue();
> Eclipse auto-changes this to
> final Comparable<Comparable<?>> compareMe = getCompareValue();
I cannot reproduce that with my (oldish) Eclipse 3.8.1 here.
With "add type arguments" it seems to just add "<?>", and
with "Change type to Comparable<Object>" it obviously changes
it to Comparable<Object>, but I didn't get it to change it to
Comparable<Comparable<?>>.
Generally, Comparable<Object> makes little sense based on what
Comparable is designed for, namely as an anti-symmetric operation.
I was even surprised that Comparable does not restrict its type
argument, but then I remembered that were it defined like
Comparable<T extends Comparable<T>>
then it wouldn't be possible to use it with anonymous classes.
Maybe a newer eclipse than mine has some hardcoded "knowledge"
of Comparable and therefore tries to make something more sensible
than the locked-down interface would imply.
> If I just fix it to match it works fine.
> final Comparable<Object> compareMe = getCompareValue();
Consider changing already getCompareValue() to return something
better than Comparable<Object>.
> Somehow Eclipse didn't know it needed to be Comparable<Object>
> even though it auto-added the <Object> to the return value on
> the method.
That might have been deduced from your implementation of getCompareValue().
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-27 12:12 -0700
Re: What's the best way to make a cross string set? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-07-27 14:38 -0500
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-27 12:49 -0700
Re: What's the best way to make a cross string set? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-27 15:49 -0400
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-27 12:55 -0700
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-27 13:22 -0700
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-27 13:30 -0700
Re: What's the best way to make a cross string set? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-07-27 15:34 -0500
Re: What's the best way to make a cross string set? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-27 18:27 -0400
Re: What's the best way to make a cross string set? lewbloch@gmail.com - 2017-07-28 18:51 -0700
Re: What's the best way to make a cross string set? v_borchert@despammed.com (Volker Borchert) - 2017-07-29 06:03 +0000
Re: What's the best way to make a cross string set? v_borchert@despammed.com (Volker Borchert) - 2017-07-28 18:19 +0000
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-28 13:28 -0700
Re: What's the best way to make a cross string set? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-28 17:20 -0400
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-31 05:24 -0700
Re: What's the best way to make a cross string set? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-31 12:01 -0400
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-31 10:58 -0700
Re: What's the best way to make a cross string set? Sebastian <nowhere@nirvana.org> - 2017-07-31 18:13 +0200
Re: What's the best way to make a cross string set? lewbloch@gmail.com - 2017-07-31 09:24 -0700
Re: What's the best way to make a cross string set? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-31 19:24 -0400
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-01 06:36 -0700
Re: What's the best way to make a cross string set? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-08-01 10:58 -0400
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-01 08:09 -0700
Re: What's the best way to make a cross string set? lewbloch@gmail.com - 2017-08-01 09:39 -0700
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-01 10:18 -0700
Re: What's the best way to make a cross string set? Andreas Leitgeb <avl@logic.at> - 2017-08-02 09:22 +0000
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-02 05:13 -0700
Re: What's the best way to make a cross string set? Andreas Leitgeb <avl@logic.at> - 2017-08-03 14:33 +0000
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-03 08:51 -0700
Re: What's the best way to make a cross string set? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-08-03 12:20 -0400
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-03 10:15 -0700
Re: What's the best way to make a cross string set? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-08-03 13:42 -0400
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-03 11:17 -0700
Re: What's the best way to make a cross string set? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-08-05 16:08 -0400
Re: What's the best way to make a cross string set? Martin Gregorie <martin@address-in-sig.invalid> - 2017-08-05 20:31 +0000
Re: What's the best way to make a cross string set? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-08-05 17:25 -0400
Re: What's the best way to make a cross string set? Martin Gregorie <martin@address-in-sig.invalid> - 2017-08-05 22:11 +0000
Re: What's the best way to make a cross string set? Sebastian <nowhere@nirvana.org> - 2017-08-06 18:13 +0200
Re: What's the best way to make a cross string set? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-02 12:56 -0700
Re: What's the best way to make a cross string set? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-29 16:55 -0400
Re: What's the best way to make a cross string set? Sebastian <nowhere@nirvana.org> - 2017-07-29 23:56 +0200
csiph-web