Skip to content

Commit 50f99d8

Browse files
committed
Don't produce interface forwarders directed at an abstract target
1 parent b4c4a26 commit 50f99d8

File tree

4 files changed

+19
-1554
lines changed

4 files changed

+19
-1554
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ open class KotlinFileExtractor(
840840
// there to allow default method usage in Java < 8, but this is hopefully niche.
841841
!pluginContext.languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode).forAllMethodsWithBody &&
842842
f.parentClassOrNull?.origin != IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB &&
843-
f.realOverrideTarget.let { it != f && isKotlinDefinedInterface(it.parentClassOrNull) }
843+
f.realOverrideTarget.let { it != f && (it as? IrSimpleFunction)?.modality != Modality.ABSTRACT && isKotlinDefinedInterface(it.parentClassOrNull) }
844844

845845
private fun makeInterfaceForwarder(f: IrFunction, parentId: Label<out DbReftype>, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?) =
846846
forceExtractFunction(f, parentId, extractBody = false, extractMethodAndParameterTypeAccesses, typeSubstitution, classTypeArgsIncludingOuterClasses, overriddenAttributes = OverriddenFunctionAttributes(visibility = DescriptorVisibilities.PUBLIC)).also { functionId ->

java/ql/test/kotlin/library-tests/inherited-callee/test.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
| Test.java:25:5:25:16 | hashCode(...) | hashCode | Object |
44
| Test.java:26:5:26:17 | inheritMe(...) | inheritMe | Test |
55
| Test.java:28:5:28:34 | inheritedInterfaceMethodJ(...) | inheritedInterfaceMethodJ | ParentIf |
6-
| Test.kt:13:1:16:1 | inheritedInterfaceMethodK(...) | inheritedInterfaceMethodK | ParentIf |
76
| Test.kt:23:7:23:16 | toString(...) | toString | Object |
87
| Test.kt:24:7:24:15 | equals(...) | equals | Object |
98
| Test.kt:25:7:25:16 | hashCode(...) | hashCode | Object |

java/ql/test/kotlin/library-tests/java-kotlin-collection-type-generic-methods/test.expected

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,6 @@ methodWithDuplicate
416416
| Map<String,String> | replaceAll | BiFunction<? super String,? super String,? extends String> |
417417
| MutableCollection | add | E |
418418
| MutableCollection | addAll | Collection<? extends E> |
419-
| MutableCollection | contains | Object |
420-
| MutableCollection | containsAll | Collection<?> |
421419
| MutableCollection | forEach | Consumer<? super E> |
422420
| MutableCollection | remove | Object |
423421
| MutableCollection | removeAll | Collection<?> |
@@ -428,12 +426,7 @@ methodWithDuplicate
428426
| MutableList | add | int |
429427
| MutableList | addAll | Collection<? extends E> |
430428
| MutableList | addAll | int |
431-
| MutableList | contains | Object |
432-
| MutableList | containsAll | Collection<?> |
433429
| MutableList | forEach | Consumer<? super E> |
434-
| MutableList | get | int |
435-
| MutableList | indexOf | Object |
436-
| MutableList | lastIndexOf | Object |
437430
| MutableList | listIterator | int |
438431
| MutableList | remove | Object |
439432
| MutableList | remove | int |
@@ -452,10 +445,7 @@ methodWithDuplicate
452445
| MutableMap | computeIfAbsent | K |
453446
| MutableMap | computeIfPresent | BiFunction<? super K,? super V,? extends V> |
454447
| MutableMap | computeIfPresent | K |
455-
| MutableMap | containsKey | Object |
456-
| MutableMap | containsValue | Object |
457448
| MutableMap | forEach | BiConsumer<? super K,? super V> |
458-
| MutableMap | get | Object |
459449
| MutableMap | getOrDefault | Object |
460450
| MutableMap | getOrDefault | V |
461451
| MutableMap | merge | BiFunction<? super V,? super V,? extends V> |

0 commit comments

Comments
 (0)