Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.8.3, 1.9-beta-4
-
Component/s: None
-
Labels:None
-
Patch Submitted:Yes
-
Number of attachments :
Description
Groovy should ignore bridge methods.
This eliminates redundant method calls, although that isn't why
I need it.
My primary reason for this change is bit unusual; I've got a little
byte code post processor to inject synthetic bridge methods
to help me evolve code without breaking existing binaries,
<http://bridge-method-injector.infradna.com/>, and as a part of this
I generate a bridge method whose return type is narrower, instead of
wider.
That is, whereas normally bridge methods are as follows:
interface Base {
Object foo();
}
class Impl implements Base {
String foo() {...}
// the above definition causes javac to insert the following
// bridge method
@Synthetic @Bridge
Object foo() { return <String>foo(); }
}
my byte code post processing would produce this:
class Impl /* no interface needed */ {
Object foo() {...}
@Synthetic @Bridge
String foo() { return (String)<Object>foo(); }
}
This works with javac, in the sense that it'll invoke "Object foo()", by preferring non-bridge methods for resolution.
Unfortunately, Grooovy doesn't discreminate against bridge methods, so it can end up calling "String foo()" depending on the exact implementation detail of the search.
This fix eliminates this issue by making Groovy ignore all bridge methods. Would you please please include this?
Activity
| Field | Original Value | New Value |
|---|---|---|
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Assignee | Guillaume Laforge [ guillaume ] | |
| Fix Version/s | 1.8.3 [ 17657 ] | |
| Fix Version/s | 1.9-beta-4 [ 17656 ] | |
| Resolution | Fixed [ 1 ] |
| Status | Resolved [ 5 ] | Closed [ 6 ] |