Commit 3bf5333
[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.1 parent fac62f2 commit 3bf5333
File tree
4 files changed
+55
-0
lines changed- src
- Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics
- Java.Interop.Tools.JavaCallableWrappers
- Java.Interop.Tools.JavaCallableWrappers
- Test/Java.Interop.Tools.JavaCallableWrappers
4 files changed
+55
-0
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
365 | 369 | | |
366 | 370 | | |
367 | 371 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
33 | 55 | | |
34 | 56 | | |
35 | 57 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
230 | 258 | | |
231 | 259 | | |
232 | 260 | | |
| |||
0 commit comments