Skip to content
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

[JavaSrc2Cpg] - Missing type information, in case of templated object #4488

Closed
khemrajrathore opened this issue Apr 24, 2024 · 2 comments · Fixed by #4502
Closed

[JavaSrc2Cpg] - Missing type information, in case of templated object #4488

khemrajrathore opened this issue Apr 24, 2024 · 2 comments · Fixed by #4502
Assignees

Comments

@khemrajrathore
Copy link
Contributor

Is your feature request related to a problem? Please describe.
We see missing type information in scenarios when there is usage of templated objects,
Ex- List<String> user
In this case we get the type as java.util.List

Describe the solution you'd like
The type information should also show String, representing the true value of type

Ideally the same applies to Kotlin and languages where this holds true

Additional context
For the below code

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        // Create a List of Strings
        List<String> stringList = new ArrayList<>();

        // Add some elements to the list
        stringList.add("Hello");
        stringList.add("World");
        stringList.add("!");

        // Print the elements of the list
        System.out.println("Elements of the List:");
        for (String str : stringList) {
            System.out.println(str);
        }
    }
}

The type of stringList should have info of both List and String in typeFullName

@DavidBakerEffendi
Copy link
Collaborator

@khemrajrathore by templated objects don't you mean generic types?

@DavidBakerEffendi
Copy link
Collaborator

In any case, this may refer to this PR that was de-prioritized #2655

DavidBakerEffendi added a commit that referenced this issue Apr 29, 2024
The desire for type arguments to be persisted in type nodes and properties has been around for a while.

This PR adds a hidden, off-by-default flag, `keep-type-arguments`, signals to the `TypeInfoCalculator` to build the full name with the full names of the type arguments.

Resolves #4488
DavidBakerEffendi added a commit that referenced this issue Apr 29, 2024
The desire for type arguments to be persisted in type nodes and properties has been around for a while.

This PR adds a hidden, off-by-default flag, `keep-type-arguments`, signals to the `TypeInfoCalculator` to build the full name with the full names of the type arguments.

Resolves #4488
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 a pull request may close this issue.

2 participants