Add 'readLenient' function to 'KotlinModuleMetadata'. - #7644
Open
Tony Robalik (autonomousapps) wants to merge 11 commits into
Open
Add 'readLenient' function to 'KotlinModuleMetadata'.#7644Tony Robalik (autonomousapps) wants to merge 11 commits into
Tony Robalik (autonomousapps) wants to merge 11 commits into
Conversation
I use that function [here](https://github.com/autonomousapps/dependency-analysis-gradle-plugin/blob/22dcdfeb5a2f5a18c709b9c8f3c50692805a7c3a/src/main/kotlin/com/autonomousapps/model/internal/KtFile.kt#L54) in my Gradle plugin. Some collaborators and I recently had to go back and forth for almost two months to find a solution in [this PR](autonomousapps/dependency-analysis-gradle-plugin#1719) for the lack of lenient read support. I use the analogous `KotlinClassMetadata.readLenient()` in two places, [here](https://github.com/autonomousapps/dependency-analysis-gradle-plugin/blob/22dcdfeb5a2f5a18c709b9c8f3c50692805a7c3a/src/main/kotlin/com/autonomousapps/tasks/FindKotlinMagicTask.kt#L325) for example. I only need to read Kotiln metadata, not write it. My plugin analyzes class files to provide dependency-related advice to Android, JVM, and KMP projects. This missing API / TODO caused me a lot of trouble and I wanted to contribute back instead of just complain about it. I'm aware of the deficiencies in the PR. I wasn't sure of the appetite for a contribution so this was my test. I looked for tests and didn't find anything obvious. Pointers are welcome. I will note that the `KotlinClassMetadata` class uses a mutable var for the writability check, so I'm not sure that my immutable boolean in the constructor is that much worse. But of course I'd be willing to change things to match project standards.
because read() is used during bootstrap process in Gradle buildscript
Code Owners
PR commands for maintainers
|
Alexander Udalov (udalov)
requested a review
from Leonid Startsev (sandwwraith)
August 21, 2026 17:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #6956.