line number of bridge method

Robert Field robert.field at oracle.com
Tue Dec 9 23:28:31 UTC 2014


I believe the downside of having line numbers is you then would, in a 
debugger, step into the bridge.

-Robert


On 12/09/14 14:55, Mike Duigou wrote:
> Would it be possible to have the debug line number of a bridge method 
> be the line number of the method it is a bridge for rather than the 
> first line of the class?
>
> java.lang.ClassCastException: java.lang.Byte cannot be cast to 
> java.lang.String
> at com.foo.bar.MyHashMap.put(MyHashMap.java:18)
>
> MyHashMap is declared as "extends HashMap<String,Object>" so there is 
> a put(String, Object) bridge method in addition to the put(Object, 
> Object) method.
>
> Understandably if MyHashMap were to not override put(Object, Object) 
> and just use HashMap's implementation it would probably be necessary 
> to use the current "first line of the class" solution for the 
> put(String, Object) bridge method.
>
> Cheers,
>
> Mike
>



More information about the compiler-dev mailing list