Consider the following code:
List<Integer>ints= new ArrayList<Integer>();
lst.add(new Object());//no suitable method found for add(Object)...
Why this error is causing? On a compile time we have type erasure, and method boolean add (E e)
after erasure will have signature add(Object o)
. Can you write in detail how ompiler work in this case?
And what about bridge method? As i understood bridge metod have the following implements:
boolean add(Object o){return this.add((Integer) o)}