Middle
In what cases is inline usage impossible or impractical?
sobes.tech AI
Answer from AI
- Member functions of classes with the
privateorinternalmodifier. - Functions marked with @NoInline or @DontInline annotations.
- Functions containing local classes or anonymous objects that reference variables from the function's scope.
- Recursive functions.
Use is not advisable:
- Functions with a large amount of code. Excessive inlining increases the APK size.
- When a function is called many times in loops or other heavily used code sections.
- When a function contains try/catch blocks, which can affect JIT compiler optimizations.
- Functions called from Java code (since Java does not understand Kotlin's
inline).