• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unchecked conversion

 
amarshi mohanty
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,



is converted to



If there is no generic information (Type Erasure Concept), then why the below warning message is thrown by compiler.Does it mean that internally some kind of mapping about <String> stored?

I will define a generic object and assign it to a non-generic type


Regards,
amarshi
 
Matthew Brown
Bartender
Posts: 4567
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no generic information available at run-time...but the compiler isn't running at run time. It runs at compile time (hence the name!). The compiler has full access to all the information in the source code. So the compiler knows you're assigning a non-generic reference to a generic one, and it knows that isn't safe.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic