Skip to content

Java: Generic Class Methods not connected when type parameter is unknown (build-mode=none) #19538

Open
@odipar

Description

@odipar

The introduction of build-mode=none has been very helpful for us. This allows us to create (partial) CodeQL databases, without being forced to fully resolve (maven) dependencies. Sometimes this is convenient because some dependencies might not be easily resolvable.

That said, we also see many examples of Generic Classes and Methods in our codebases. Unfortunately, we cannot analyse (calls to) Generic Methods that are instantiated with type parameters that are unknown.

Note that, while the code of the type parameter T is unavailable, the code of the GenericClass<T> is available.

Example pseudo code

 class GenericClass<T> { 
      public method() { ...  };
  };

  GenericClass<UnknownType> i1 = new GenericClass<>();
  i1.method(); // not connected
  GenericClass<Boolean> i2 = new GenericClass<>();
  i2.method(); // connected

See attached codeql_issue.zip zip file for a more thorough analysis of the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions