Skip to content

Commit 9b7cfd8

Browse files
author
Max Schaefer
committed
Clarify relationship of isFromSource and Element::fromSource.
1 parent 3e8775d commit 9b7cfd8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

java/ql/automodel/src/AutomodelJavaUtil.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,15 @@ predicate includeAutomodelCandidate(string package, string type, string name, st
8686
/**
8787
* Holds if the given program element corresponds to a piece of source code,
8888
* that is, it is not compiler-generated.
89+
*
90+
* Note: This is a stricter check than `Element::fromSource`, which simply
91+
* checks whether the element is in a source file as opposed to a JAR file.
92+
* There can be compiler-generated elements in source files (especially for
93+
* Kotlin), which we also want to exclude.
8994
*/
9095
predicate isFromSource(Element e) {
96+
// from a source file (not a JAR)
97+
e.fromSource() and
9198
// not explicitly marked as compiler-generated
9299
not e.isCompilerGenerated() and
93100
// does not have a dummy location

0 commit comments

Comments
 (0)