Files
codeql/java/ql/src/Language Abuse/IterableClass.qll
2026-02-04 14:43:31 +01:00

19 lines
525 B
Plaintext

import java
/** A class that implements `java.lang.Iterable`. */
class Iterable extends Class {
Iterable() {
this.isSourceDeclaration() and
this.getASourceSupertype+().hasQualifiedName("java.lang", "Iterable")
}
/** The return value of a one-statement `iterator()` method. */
Expr simpleIterator() {
exists(Method m |
m.getDeclaringType().getSourceDeclaration() = this and
m.getName() = "iterator" and
m.getBody().(SingletonBlock).getStmt().(ReturnStmt).getExpr() = result
)
}
}