-
Notifications
You must be signed in to change notification settings - Fork 300
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
[kotlin2cpg] Improve fullnames. #4988
Merged
Merged
Conversation
This file contains 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
fc98ac0
to
a8a56cc
Compare
maltek
reviewed
Oct 9, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks much better than before :)
joern-cli/frontends/kotlin2cpg/src/main/scala/io/joern/kotlin2cpg/Kotlin2Cpg.scala
Outdated
Show resolved
Hide resolved
...i/frontends/kotlin2cpg/src/main/scala/io/joern/kotlin2cpg/ast/AstForExpressionsCreator.scala
Show resolved
Hide resolved
...i/frontends/kotlin2cpg/src/main/scala/io/joern/kotlin2cpg/ast/AstForExpressionsCreator.scala
Outdated
Show resolved
Hide resolved
...li/frontends/kotlin2cpg/src/main/scala/io/joern/kotlin2cpg/ast/AstForPrimitivesCreator.scala
Show resolved
Hide resolved
joern-cli/frontends/kotlin2cpg/src/main/scala/io/joern/kotlin2cpg/types/NameRenderer.scala
Outdated
Show resolved
Hide resolved
joern-cli/frontends/kotlin2cpg/src/test/scala/io/joern/kotlin2cpg/querying/ExtensionTests.scala
Outdated
Show resolved
Hide resolved
joern-cli/frontends/kotlin2cpg/src/test/scala/io/joern/kotlin2cpg/querying/ExtensionTests.scala
Show resolved
Hide resolved
maltek
approved these changes
Oct 11, 2024
993373e
to
28df4db
Compare
maltek
approved these changes
Oct 21, 2024
Improve and cleanup the fullname calculation for methods and callsites. The most noteable changes here are: 1. The lambda function naming schema changed from `package.<fileName>.<lambda>counter:signature` to `package.scope.<lambda>counter:signature`. This give a better indication which lambda function is represented also gets rid of exception of using the filename in the method fullnames. 2. Fixed lambda function signatures. 3. The fullname schema of extension methods changed from `extendedClassFullName.extensionMethodName:signatureWithoutThisParameter` to `package.extensionMethodName:signatureWithThisParameter` The fact that the this parameter is part of the signature is an exception in our java fullnames but necessary in order to distinguish otherwise identical extension methods. 4. We avoid the recalculation of the binding context with every file processed. This is now done once at the begining. 5. Calls to `::class` are now represented as calls to `<operator>.class`.
The instance arg/param now have index 1 as they are not the receiver on which the call is dispatches. It is a static call after all.
Additionally fixed the inheritance information for lambda type decl nodes.
Split some methods into BindingContextUtils and renamed those methods.
- No more special case for handling `kotlin.Function`. - Removed some unused code. - Stop using currentTimeMillis.
This results in expresssion types now being renderer in the new fassion.
- Removed implicitParameterName and hasApplyOrAlsoScopeFunctionParent APIs from TypeInfoProvider. - Removed wrong parameter deconstruction in lambda. New implemention is missing. - Some lambda to builtin `apply` and `also` functions did not get return statements generated. That is now fixed.
…oProvider. Also refactored assignmentAstForDestructuringEntry. The right hand side base is now created outside of this function allowing for other constructs than pure identifiers. The pure identifier were e.g. wrong in case of class member references.
44fec0e
to
7a949ea
Compare
In case of incomplete type information calls with overloads can get ambiguous. We now use the ambiguous function descriptors to get as much of a methodFullName correct as possible.
23b9f5c
to
f0e5106
Compare
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.
Improve and cleanup the fullname calculation for methods and callsites.
The most noteable changes here are:
package.<fileName>.<lambda>counter:signature
topackage.scope.<lambda>counter:signature
.This give a better indication which lambda function is represented
also gets rid of exception of using the filename in the method
fullnames.
extendedClassFullName.extensionMethodName:signatureWithoutThisParameter
to
package.extensionMethodName:signatureWithThisParameter
The fact that the this parameter is part of the signature is an
exception in our java fullnames but necessary in order to distinguish
otherwise identical extension methods.
processed. This is now done once at the begining.
::class
are now represented as calls to<operator>.class
.--keep-type-arguments
has no effect anymore. This feature was only implemented partially andwe might bring it back later.