Skip to content

Commit 87b971c

Browse files
authored
Merge pull request github#10728 from tamasvajk/kotlin-missing-override-sam
Kotlin: Extract `override` modifier on SAM methods
2 parents cd8ac1a + 26c4216 commit 87b971c

File tree

3 files changed

+176
-3
lines changed

3 files changed

+176
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4998,7 +4998,7 @@ open class KotlinFileExtractor(
49984998
class <Anon> extends Object implements IntPredicate {
49994999
Function1<Integer, Boolean> <fn>;
50005000
public <Anon>(Function1<Integer, Boolean> <fn>) { this.<fn> = <fn>; }
5001-
public Boolean accept(Integer i) { return <fn>.invoke(i); }
5001+
public override Boolean accept(Integer i) { return <fn>.invoke(i); }
50025002
}
50035003
50045004
IntPredicate x = (IntPredicate)new <Anon>(...);
@@ -5078,6 +5078,7 @@ open class KotlinFileExtractor(
50785078
// the real underlying R Function<T, R>.apply(T t).
50795079
forceExtractFunction(samMember, classId, extractBody = false, extractMethodAndParameterTypeAccesses = true, typeSub, classTypeArgs, overriddenAttributes = OverriddenFunctionAttributes(id = ids.function, sourceLoc = tw.getLocation(e)))
50805080

5081+
addModifiers(ids.function, "override")
50815082
if (st.isSuspendFunctionOrKFunction()) {
50825083
addModifiers(ids.function, "suspend")
50835084
}

0 commit comments

Comments
 (0)