-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bad code generation involving method references and generics.
When a method reference is assigned to a generic functional interface like: interface I<T> { boolean m(T o); } public class C { public boolean f(); } .... I<C> methodReference = C::f; The implementation of the method reference is roughly class SynthesizedImplementation implements I { public boolean m(Object o) { o.f(); } Note the lack of generics (internally GWT does all the transformations suing raw types). Because the type of "o" is object, the above code is not type correct and some of the compiler passes get confused (in the small repro example it is the Devirtualizer that gets confused and devitualizes that method as if it were an Object method). This patch correctly inserts the required cast. class SynthesizedImplementation implements I { public boolean m(Object o) { ((C) o).f(); } Change-Id: I2286516157aa58181987629891c3c2c00951bdd1 Bug-Link:#9214
- Loading branch information
Showing
4 changed files
with
104 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters