• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Generics - capture of ...

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone !

Consider this:

I know that it doesn't work and it shouldn't work.
What I am interested in is the mechanisms used by compiler
to resolve this problem. When you compile it, I assume that
? super Integer is changed to some kind of a class. If it
does, how is it then compared to other Objects ? The bottom line:
If ? super Integer is translated into some kind of object
which is then called by the compiler capture of ? super Integer,
how this object can be compared to lets say Object ?

Or maybe I am wrong and that's not the way compiler works here ?
If not, what is the purpose of "capture of" mechanism and
how is it used ?


Thanks,

Adrian
 
Adrian Sosialuk
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again,

I am really sorry for multiple sending the same post - I had
some problems with my FireFox ...


Adrian
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Frankly, I have no idea. I would imagine that whatever gets compiled into can be compared to Objects.

Anyway, I did a little search and maybe this page can clarify:
http://angelikalanger.com/GenericsFAQ/FAQSections/TechnicalDetails.html#Wildcard%20Capture
 
Adrian Sosialuk
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Kuri,

Yeah, although it mention about some compiler work
under the cover, it doesn't explain it fully :/

I'll try to look at JLS this evening - perhaps I'll
find something useful there


Cheers,

Adrian
 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Erasure will remove any traces of <? super Integer>
 
Rototillers convert rich soil into dirt. Please note that this tiny ad is not a rototiller:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic