Visitar URL original
Preserve Kotlin inferred-return method visibility in abstract classes by jkschneider · Pull Request #1217 · openrewrite/rewrite-static-analysis · GitHub
Skip to content

Preserve Kotlin inferred-return method visibility in abstract classes - #1217

Merged
jkschneider merged 1 commit into
mainfrom
csa/kotlin-constructor-visibility
Nov 6, 2026
Merged

jkschneider merged 1 commit into
mainfrom
csa/kotlin-constructor-visibility

Conversation

@jkschneider

Copy link
Copy Markdown
Member

AbstractClassPublicConstructor treats a Kotlin method with an inferred return type as a constructor. In OkHttp Dispatcher, public open override fun close() {} becomes protected and fails compilation because the override narrows visibility.

Require attributed constructor identity when available, with a declaring-class name check for unattributed Java constructors. Add a regression for the Kotlin override and a control preserving remediation of a real secondary constructor.

Validation: the new override regression fails before the fix; all six AbstractClassPublicConstructorTest tests pass afterward. The exact-bundle recipe-only OkHttp replay and a minimal Kotlin compile reproduce the original failure.

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Nov 6, 2026
@jkschneider
jkschneider merged commit 2ed286d into main Nov 6, 2026
1 check passed
@jkschneider
jkschneider deleted the csa/kotlin-constructor-visibility branch November 6, 2026 10:46
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant