-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
questionFurther information is requestedFurther information is requested
Description
There are several issues with IntersectionType:
- It currently only provides
getFirstBound(), there are no other predicates to get the other bounds (thoughgetASubtype()can apparently be used as workaround) - It does not preserve order of the bounds (i.e.
MyInterface2 & MyInterface1would becomeMyInterface1 & MyInterface2) - It requires that
getFirstBound()is a class, returningObjectwhen only interfaces are used as bounds; that is (to my understanding) wrong
It would be good to give it the following predicates:
getFirstBoundType()getBoundType(int position)getABoundType()
(I cannot submit a pull request for this because it appears that database changes are required for this)
Side note: Usage of IntersectionType in erase(Type) will also behave incorrectly due to the getFirstBound() behavior described above, and also does not match the JLS which does not mention intersection types for type erasure (not sure what the correct behavior would be here).
codeql/java/ql/src/semmle/code/java/Type.qll
Line 1014 in a760ed8
| result = erase(t.(IntersectionType).getFirstBound()) |
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested