Skip to content

[kotlin2cpg] Use unique namespace fullNames for imports and for packages#5854

Merged
SuperUserDone merged 2 commits intomasterfrom
louis/kotlin2cpg-namespace-fix
Mar 5, 2026
Merged

[kotlin2cpg] Use unique namespace fullNames for imports and for packages#5854
SuperUserDone merged 2 commits intomasterfrom
louis/kotlin2cpg-namespace-fix

Conversation

@SuperUserDone
Copy link
Contributor

@SuperUserDone SuperUserDone commented Mar 4, 2026

This solves the policylinker issue, but not sure that imports are being represented correctly. From what I can tell javasrc does not create namespace blocks for imports.

https://github.com/joernio/joern/blob/master/joern-cli/frontends/javasrc2cpg/src/main/scala/io/joern/javasrc2cpg/astcreation/AstCreator.scala#L236-L259

@SuperUserDone SuperUserDone requested a review from ml86 March 4, 2026 07:16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name property of the namespace block for PackageFoo is wrong. The name property shall contain the fully qualified name com.test.PackageFoo.

@ml86
Copy link
Contributor

ml86 commented Mar 4, 2026

You are right, the imports are not represented correctly in the sense that an import statement should not result in the generation of a namespace block for the imported entity.
Please also address this in this PR.

@SuperUserDone
Copy link
Contributor Author

Have resolved the naming issue and removed the redundant namespace block generation.

@SuperUserDone SuperUserDone requested a review from ml86 March 5, 2026 08:49
@SuperUserDone SuperUserDone merged commit fb0e8e6 into master Mar 5, 2026
8 checks passed
@SuperUserDone SuperUserDone deleted the louis/kotlin2cpg-namespace-fix branch March 5, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants