mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
import java
|
|
|
|
string topToString(Top t) {
|
|
result = t.toString()
|
|
or
|
|
// TypeBound doesn't extend Top (but probably should)
|
|
result = t.(TypeBound).toString()
|
|
or
|
|
// XMLLocatable doesn't extend Top (but probably should)
|
|
result = t.(XMLLocatable).toString()
|
|
or
|
|
// Java #142
|
|
t instanceof FieldDeclaration and not exists(t.toString()) and result = "<FieldDeclaration>"
|
|
or
|
|
// Java #143
|
|
t instanceof Javadoc and not exists(t.toString()) and result = "<Javadoc>"
|
|
or
|
|
// Java #144
|
|
t instanceof ReflectiveAccessAnnotation and not exists(t.toString()) and result = "<ReflectiveAccessAnnotation>"
|
|
}
|
|
|
|
string not1ToString() {
|
|
exists(Top t | count(topToString(t)) != 1 and result = "Top which doesn't have exactly 1 toString: " + concat(t.getAQlClass(), ", "))
|
|
or
|
|
exists(Location l | count(l.toString()) != 1 and result = "Location which doesn't have exactly 1 toString: " + concat(l.getAQlClass(), ", "))
|
|
or
|
|
exists(Module m | count(m.toString()) != 1 and result = "Module which doesn't have exactly 1 toString: " + concat(m.getAQlClass(), ", "))
|
|
or
|
|
exists(Directive d | count(d.toString()) != 1 and result = "Directive which doesn't have exactly 1 toString: " + concat(d.getAQlClass(), ", "))
|
|
}
|
|
|
|
select not1ToString()
|
|
|