From 9b7cfd88cd23cc97780656c8258eb12bb4eebb98 Mon Sep 17 00:00:00 2001 From: Max Schaefer Date: Tue, 9 Jan 2024 16:21:36 +0000 Subject: [PATCH] Clarify relationship of `isFromSource` and `Element::fromSource`. --- java/ql/automodel/src/AutomodelJavaUtil.qll | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/java/ql/automodel/src/AutomodelJavaUtil.qll b/java/ql/automodel/src/AutomodelJavaUtil.qll index bc389e6eb0f..e1a1d36c1a0 100644 --- a/java/ql/automodel/src/AutomodelJavaUtil.qll +++ b/java/ql/automodel/src/AutomodelJavaUtil.qll @@ -86,8 +86,15 @@ predicate includeAutomodelCandidate(string package, string type, string name, st /** * Holds if the given program element corresponds to a piece of source code, * that is, it is not compiler-generated. + * + * Note: This is a stricter check than `Element::fromSource`, which simply + * checks whether the element is in a source file as opposed to a JAR file. + * There can be compiler-generated elements in source files (especially for + * Kotlin), which we also want to exclude. */ predicate isFromSource(Element e) { + // from a source file (not a JAR) + e.fromSource() and // not explicitly marked as compiler-generated not e.isCompilerGenerated() and // does not have a dummy location