java - Type erasure interferes with polymorphism -


i reading core java volume , encounter question in translating generic expression. here book said.

enter image description here

i don't understand why there interfere. highlighted sentence, why setsecond(object) method called? shouldn't setsecond(date) method since interval dateinterval object?

the main problem, think, comes between brackets (in case ) exists when you're writing code. it's compilation-time checking. that's type erasure about. when compile code, have references object , these bridge methods in bytecodes.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo