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

KT-64882 Fix KAPT stub for useJvmIr=False #5242

Open
wants to merge 1 commit into
base: 1.9.30
Choose a base branch
from

Conversation

acejingbo
Copy link
Contributor

@acejingbo acejingbo commented Jan 10, 2024

KT-64882 I found KAPT useJvmIr=false have stub gen wrongness (all function is missing from stub)

After debug i found the reason functions are missing in stub!
The direct reason is, in ClassFileToSourceStubConverter.kt, kaptContext.origins contain methods with null descriptor, causing “convertMethod” to return skip the method.
As to how is the method's origin.descriptor get lost, i found it's lost during the origin.unwrapOrigin() and declaration.wrapToOrigin() of ClassBuilderExtensionAdapter. Anything that's not JvmIrDeclarationOrigin became NO_ORIGIN after a round of wrap and unwrap (But things are always not JvmIrDeclaration when useJvmIr=false). So existence of any ClassGeneratorExtension (like JvmAbiGen) will make the origin lost its descriptor

I tried skipping ClassBuilderExtensionAdapter in GenerationState.loadClassBuilderInterceptors whenever isIrBackend=false, and the problem is indeed gone, which confirmed this is the cause

Synced with @udalov and confirmed this solution make sense and can submit PR

@acejingbo acejingbo changed the title Fix KAPT stub for useJvmIr=False KT-64882 Fix KAPT stub for useJvmIr=False Jan 10, 2024
@udalov udalov self-assigned this Jan 10, 2024
@udalov udalov added the KAPT label Jan 10, 2024
@acejingbo acejingbo changed the base branch from master to 1.9.30 January 11, 2024 20:06
@acejingbo acejingbo changed the base branch from 1.9.30 to master January 11, 2024 20:11
@acejingbo acejingbo changed the base branch from master to 1.9.30 January 11, 2024 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants