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


Groups > comp.lang.java.programmer > #12239

Re: Hairy generics question

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.programmer
Subject Re: Hairy generics question
Date Tue, 21 Feb 2012 12:09:38 -0800
Organization albasani.net
Lines 55
Message-ID <ji0tm4$c50$1@news.albasani.net> (permalink)
References <3c65271e-a388-49c9-bcc6-ca3bf274e74f@e27g2000vbu.googlegroups.com> <chq7k7d406ooh82tlklh0eu67ts2jc024v@4ax.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.albasani.net 0+Gz7tu723Jzy8GkoEMBSvB5BUcCsz01q3oCpSw7UvQR4Z3Uwwwzh/dYw+h5HbobjFOKAkEAIiWDGfIq7+HjP/DwadJYaNv3dY4yi0KacQqrtL0cDuAtD3t8BztTNWH4
NNTP-Posting-Date Tue, 21 Feb 2012 20:09:40 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="ogNVv+++PHgBQj+REK3Zz0YrkIKOFwR9eD+KEIDGeUdw15r3kop4v0jeBM9ntbgA/qw0Ck86RHCBHFFObrvfC4B95/7TdVA5wLPLwlAI+BaRdPi0fcd6cWbiz80EB+ZP"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2
In-Reply-To <chq7k7d406ooh82tlklh0eu67ts2jc024v@4ax.com>
Cancel-Lock sha1:/dwKVvcabT8zKJdTpkRw0gded2s=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:12239

Show key headers only | View raw


On 02/21/2012 11:05 AM, Roedy Green wrote:
> On Tue, 21 Feb 2012 06:30:51 -0800 (PST), sclaflin
> <steve@steveclaflin.com>  wrote, quoted or indirectly quoted someone
> who said :
>
>> Why can I use a class that extends CompItemView for the V type, and
>> not CompItemView itself?
>
> Possibly because it thinks you are trying to implement multiple
> abstract classes not  Interfaces.  Generics don't use the term
> "extends" consistently which sows confusion.  I did not follow your
> details. I am just throwing that out.

Red herring. The OP used the keyword 'extends' in syntactically correct 
fashion. There is no implication of "trying to implement multiple abstract 
classes", not least because the OP has not averred such a compilation failure 
but one of failure to match bounded parameters.

Remember that the compiler - nor, indeed, the programmer - can know which 
binding of the parameter applies. Thus when there are no type assertions tying 
the generics parameters together, you have a "bound parameter" mismatch. You 
cannot assert the types are the same.

Plus, the OP tried to use 'CompItemView', a raw type!, where the assertion 
asked for a generics parameter. NEVER USE THE RAW TYPE OF A GENERIC!

It just doesn't extend the same generics parameters as the target declaration.

The OP is trying to shoehorn a type into the 'V' parameter that doesn't meet 
the declared restrictions:
'CompItemView<AInfo, CompA, CompItemView<AInfo, CompA, CompItemView>>'

The OP's type assertions are tangled, inconsistent and incorrect. This is 
normal when sussing out type assertions. Type reasoning isn't easy. One way to 
ameliorate that is to keep your assertions simple to start with. Avoid 
circularity except where it makes sense (as in

  public abstract class Enum<E extends Enum<E>>
     implements Comparable<E>, Serializable

and

  public enum TimeUnit extends Enum<TimeUnit>

).

In the OP's case we have generics parameter triplets, where the triplet 
elements themselves depend on the same triplet parameters, with random 
'extends' clauses tossed in. I'm curious as to the OP's intended type 
assertions here - if they share that we can help translate them into generics.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Hairy generics question sclaflin <steve@steveclaflin.com> - 2012-02-21 06:30 -0800
  Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-21 09:24 -0800
  Re: Hairy generics question Roedy Green <see_website@mindprod.com.invalid> - 2012-02-21 11:05 -0800
    Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-21 12:09 -0800
  Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-21 18:04 -0800
    Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-21 18:31 -0800
    Re: Hairy generics question Steven Simpson <ss@domain.invalid> - 2012-02-22 08:31 +0000
  Re: Hairy generics question sclaflin@webucator.com - 2012-02-24 11:12 -0800
    Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-24 12:03 -0800
      Re: Hairy generics question sclaflin@webucator.com - 2012-02-24 14:07 -0800
        Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-24 15:36 -0800
          Re: Hairy generics question sclaflin@webucator.com - 2012-02-25 10:27 -0800
          Re: Hairy generics question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-26 13:13 -0400
            What is Model View Presenter. (Was: Hairy generics question) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-26 10:22 -0800
              Re: What is Model View Presenter. (Was: Hairy generics question) Lew <noone@lewscanon.com> - 2012-02-26 13:08 -0800
                Re: What is Model View Presenter. (Was: Hairy generics question) Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 18:17 -0500
                Re: What is Model View Presenter. (Was: Hairy generics question) sclaflin@webucator.com - 2012-02-28 06:22 -0800
            Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-28 09:46 -0800
              Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-28 09:49 -0800
              Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-28 12:45 -0800
              Re: Hairy generics question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-29 19:37 -0400
                Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-29 22:32 -0800

csiph-web