native
native copied to clipboard
Correctly rename inherited methods
When Foo extends Bar, we're renaming the methods of Foo with the same descriptor to use the same name as the ones in Bar.
This is not always correct. Take:
public class Bar<T> {
public T method() { /* ... */ }
}
public class Foo extends Bar<String> {}
After the type erasure, Bar's method descriptor becomes ()Ljava/lang/Object;. However Foo's method decriptor is ()Ljava/lang/String; even though technically these two methods must be renamed to the same thing.
Java will also generates a bridge method to preserve polymorphism. Not generating this method will fix any naming clashes, but still the generated method of Foo will get a 1 suffix.