Java: Wildcard reports implicit Object as bound
- Linguagem predominante
- CodeQL
- Estrelas
- 10.1k
- Forks
- 2.1k
- Merge médio
- 2d 15h
- PRs com merge (30d)
- 141
Descrição
The class [`Wildcard`](https://codeql.github.com/codeql-standard-libraries/java/semmle/code/java/Generics.qll/type.Generics$Wildcard.html) reports `Object` as bound when it has no bounds; this creates inconsistencies and renders some predicates useless:
- [`hasTypeBound()`](https://codeql.github.com/codeql-standard-libraries/java/semmle/code/java/Generics.qll/predicate.Generics$Wildcard$hasTypeBound.0.html) (inherited from `BoundedType`) apparently always holds
- `hasTypeBound()` is inconsistent with `TypeVariable.hasTypeBound()` which only holds for explicit bounds
- It is inconistent with [`WildcardTypeAccess`](https://codeql.github.com/codeql-standard-libraries/java/semmle/code/java/Expr.qll/type.Expr$WildcardTypeAccess.html) which only considers explicit bounds (though it could not report the implicit bound anyways since it is not an `Expr`)
Therefore it would be good to change `Wildcard` in the following ways:
- `hasTypeBound()` should only hold if an explicit bound is present
- `getUpperBound()` should only have an explicit bound as result (currently it has the implicit `Object` bound as result)
`hasUpperBound()` can probably remain as is.
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.