You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that for a RawType the result of getASourceSupertype() will not be the generic type. (This is also described by the getASourceSupertype()documentation.)
In addition to that there are the following issues:
CodeQL raw types have a <> at the end of their name, therefore a check for the class name such as getDeclaringType().getASourceSupertype*().hasQualifiedName("java.util", "List") would not hold due to the trailing <>.
Access of static fields and methods declared on a generic class, but only when explicitly using the declaring class as qualifier, are treated like accesses on a raw type (fieldAccess.getQualifier().getType() and methodAccess.getDeclaringType() will have a raw type as result).
Whether that is the correct behavior might be a different story (now Java: Static method access with explicit qualifier on generic type claims declaring type is raw type #5593).
This all combined causes some false negatives for the pattern getDeclaringType().getASourceSupertype*() (which is also used a few times in the CodeQL codebase).
Is there a more 'correct' predicate for this task? A workaround might be getDeclaringType().getASourceSupertype*().getErasure().
If there is no alternative currently, would it make sense to change the behavior of getASourceSupertype() or introduce a new predicate?
It appears that for a
RawTypethe result ofgetASourceSupertype()will not be the generic type. (This is also described by thegetASourceSupertype()documentation.)In addition to that there are the following issues:
<>at the end of their name, therefore a check for the class name such asgetDeclaringType().getASourceSupertype*().hasQualifiedName("java.util", "List")would not hold due to the trailing<>.fieldAccess.getQualifier().getType()andmethodAccess.getDeclaringType()will have a raw type as result).Whether that is the correct behavior might be a different story (now Java: Static method access with explicit qualifier on generic type claims declaring type is raw type #5593).
This all combined causes some false negatives for the pattern
getDeclaringType().getASourceSupertype*()(which is also used a few times in the CodeQL codebase).Is there a more 'correct' predicate for this task? A workaround might be
getDeclaringType().getASourceSupertype*().getErasure().If there is no alternative currently, would it make sense to change the behavior of
getASourceSupertype()or introduce a new predicate?