-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
Cause Known
-
generic
-
generic
Stack traces from bridge methods are confusing:
$ /usr/java/jdk1.6.0/bin/javac -fullversion
javac full version "1.6.0-ea-b33"
$ /usr/java/jdk1.6.0/bin/javac Bridge.java
$ /usr/java/jdk1.6.0/bin/java Bridge
Exception in thread "main" java.lang.Error
at Bridge.getName(Bridge.java:10)
at Bridge.getName(Bridge.java:5)
at Bridge.main(Bridge.java:7)
$ cat -n Bridge.java
1 interface Foo {
2 CharSequence getName();
3 }
4
5 public class Bridge implements Foo {
6 public static void main(String... args) {
7 ((Foo)new Bridge()).getName();
8 }
9 public String getName() {
10 throw new Error();
11 }
12 }
$
In this example, the confusing stack trace is:
at Bridge.getName(Bridge.java:5)
Perhaps this would be less confusing if the position
of the method declaration is used (line 9 in this example).
###@###.### 2005-05-04 08:41:06 GMT
$ /usr/java/jdk1.6.0/bin/javac -fullversion
javac full version "1.6.0-ea-b33"
$ /usr/java/jdk1.6.0/bin/javac Bridge.java
$ /usr/java/jdk1.6.0/bin/java Bridge
Exception in thread "main" java.lang.Error
at Bridge.getName(Bridge.java:10)
at Bridge.getName(Bridge.java:5)
at Bridge.main(Bridge.java:7)
$ cat -n Bridge.java
1 interface Foo {
2 CharSequence getName();
3 }
4
5 public class Bridge implements Foo {
6 public static void main(String... args) {
7 ((Foo)new Bridge()).getName();
8 }
9 public String getName() {
10 throw new Error();
11 }
12 }
$
In this example, the confusing stack trace is:
at Bridge.getName(Bridge.java:5)
Perhaps this would be less confusing if the position
of the method declaration is used (line 9 in this example).
###@###.### 2005-05-04 08:41:06 GMT