• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Overloading with Widen-and-Box - Sierra & Bates

 
Ranch Hand
Posts: 525
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Below, to find a signature match, the compiler first widens the 'boy' value all the way to double.
Its second choice is to box it into a Byte. If this fails, the Byte object is "widened" to type Object
("Is-A" test). The compiler then gives up; it doesn't widen and then box 'boy' into a Short object.
The S&B book simply says, "This is just too much for the compiler." My question is for clarification. I don't see a conceptual problem with trying to find an override match
by looking across the wrapper classes. Why was it decided that this should not be done? Was it to
avoid the processing required?

Jim ... ...
reply
    Bookmark Topic Watch Topic
  • New Topic