Kotlin: Simplify kotlinFunctionToJavaEquivalent#10646
Merged
igfoo merged 11 commits intoOct 4, 2022
Merged
Conversation
tamasvajk
commented
Oct 3, 2022
Comment on lines
+201
to
+205
| val syntheticToRealClassMap = HashMap<IrClass, IrClass?>() | ||
| val syntheticToRealFunctionMap = HashMap<IrFunction, IrFunction?>() | ||
| val syntheticToRealFieldMap = HashMap<IrField, IrField?>() | ||
|
|
||
| val deduplicatedWarnings = mutableSetOf<String>() |
Contributor
Author
There was a problem hiding this comment.
Shouldn't these be some variants of concurrent maps? Is there any guarantee that we run single threaded? Could KotlinExtractorExtension::generate be invoked by kotlinc from multiple threads?
igfoo
reviewed
Oct 3, 2022
| val msg = "Couldn't find a Java equivalent function to $parentFqName.${f.name.asString()} in ${javaClass.fqNameWhenAvailable?.asString()}" | ||
| if (!globalExtensionState.deduplicatedWarnings.contains(msg)) { | ||
| logger.warn(msg) | ||
| globalExtensionState.deduplicatedWarnings.add(msg) |
Contributor
There was a problem hiding this comment.
Note that https://github.com/github/codeql/blob/main/java/kotlin-extractor/src/main/kotlin/utils/Logger.kt#L117 is already going to limit the number of any kind of warning to (by default) 100, so although this is more specific, I'm not sure that it's worth the extra code here.
Contributor
Author
There was a problem hiding this comment.
Good point, let me revert this.
This reverts commit 7524f33.
igfoo
approved these changes
Oct 4, 2022
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.
This PR
kotlinFunctionToJavaEquivalentand instead looks up only exact member match;expectedMissingEquivalents, which was hiding the fact that some of the mappings were missing;inv,not,and,or,xor,shl,shrandushr;kotlinFunctionToJavaEquivalentto ignore nullability;only logs each missing mapping once.