github / github/codeql

Java: `Array.getPackage()` (and `Array.getQualifiedName()`) cannot be used

Open
#7,067 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

Trying to use `Array.getPackage()` or any predicate depending on it, such as `Array.getQualifiedName()`, causes a compilation error:
```
Expr::ExprParent incompatible with Type::Array in context
```

The underlying problem seems to be that `RefType.getPackage()` only considers classes and interfaces, but not arrays. Maybe for arrays it should be compilable but simply have no result (should be documented in `getPackage()` and `getQualifiedName()` for `RefType` and `Array` then; maybe for other predicates as well)?

Relates to #5320

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.