-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java.Interop.Tools.JavaCallableWrappers] XA4213 for mangled methods (#…
…537) Context: #534 Context: #535 Context: 0065de4 There are cases where Kotlin generates Java methods that are not valid Java identifiers: // `javap` output for a Kotlin type using UInt parameters public abstract class Bar { abstract void foo-WZ4Q5Ns(int); } public interface IBar { void foo-WZ4Q5Ns(int); } In this case we cannot allow the user to inherit from the class or implement the interface as the mangled method cannot be present within Java Callable Wrapper source code. We still need the class to be bound because there might be a Kotlin- created subclass that needs the base class to exist. There's no foolproof way to mark these as "not implementable". The best we can do for now is to detect if the user implements them in the `<GenerateJavaStubs/>` task / `JavaCallableWrapperGenerator` and give an informative error at that point. Update `JavaCallableWrapperGenerator` so that when a Kotlin-generated mangled method name is encountered, an XA4213 error is emitted: error XA4213: Cannot override Kotlin-generated method 'foo-WZ4Q5Ns' because it is not a valid Java method name. This method can only be overridden from Kotlin.
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 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