-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[javasrc2cpg] Generate TYPE_REF for implicit base of static field acc…
…esses. (#5036) * [javasrc2cpg] Generate TYPE_REF for implicit base of static field accesses. For static field access like `String x = staticField1;` we used to generate a IDENTIFIER with the name of the class declaring the static field as base for the field access operator. Now we generate a TYPE_REF referencing the declaring type. This better represents the actual situation where there is no local variable for a class/type which in practice also resulted in a CPG format error because the IDENTIFIFER node was at least not in all cases linked to a LOCAL. While implementing this i reorganized the code a bit to avoid duplication. Also changes the `equals` semantic for TrackedTypeRef. Before it was based on the actual TYPE_REF node which does not make sense. Instead we need to compare the referenced TYPE itself to check if two different type references in code point to the same TYPE. * Handle statically imported field scenario.
- Loading branch information
Showing
8 changed files
with
159 additions
and
103 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.