Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Java: MemberRefExpr.getReferencedCallable() does not work for creation of arrays #5707

Copy link
Copy link
Open
@Marcono1234

Description

@Marcono1234
Issue body actions

Description

When a Method Reference Expression performs creation of an array (e.g. String[]::new), MemberRefExpr.getReferencedCallable() has no result.

This is technically correct since there exists no 'array constructor', however it might make working with MemberRefExpr more cumbersome. I created this issue mainly to discuss how this can be solved, or how the current situation can be improved. A few solutions might be:

  • Model a 'dummy' array constructor so getReferencedCallable() has a result; however, make sure that no other element by accident has this dummy constructor as result (e.g. array creation expression)
  • Adjust the documentation for getReferencedCallable() and create a new predicate getCreatedArrayType() which has in these cases the result

Example

CodeQL query:

import java

from MemberRefExpr m
where not exists(m.getReferencedCallable())
select m

Query Console link

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.