Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KTOR-7298: Load modules dynamically only if development mode is enabled #4715

Merged
merged 3 commits into from
Feb 28, 2025

Conversation

osipxd
Copy link
Member

@osipxd osipxd commented Feb 28, 2025

Subsystem
Server

Motivation
KTOR-7298 Android: "Array has more than one element" error when starting a server with release build

Solution
There were several problems with modules loading when code was optimized by R8 or ProGuard:

  1. Extension Function<*>.methodName() could throw KotlinReflectionInternalError for obfuscated methods
  2. clazz.declaredConstructors.single() in executeModuleFunction could throw IllegalArgumentException because the class could has either zero or more than one constructor (needs to be investigated further)
  3. Dynamic loading of programmatic modules seems redundant for the case when development mode is disabled

Fixed all of these issues in separate commits so it's better to review commit-by-commit.

@osipxd osipxd self-assigned this Feb 28, 2025
@osipxd osipxd force-pushed the osipxd/non-dynamic-module-loading branch from 7c7b9a6 to 6998f16 Compare February 28, 2025 11:16
@osipxd osipxd marked this pull request as ready for review February 28, 2025 14:45
@osipxd osipxd requested review from e5l and bjhham February 28, 2025 14:45
@osipxd osipxd force-pushed the osipxd/non-dynamic-module-loading branch from 6998f16 to 38b7b84 Compare February 28, 2025 16:22
@osipxd osipxd enabled auto-merge (squash) February 28, 2025 16:23
@osipxd osipxd merged commit c718419 into main Feb 28, 2025
14 of 17 checks passed
@osipxd osipxd deleted the osipxd/non-dynamic-module-loading branch February 28, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants