Skip to content

Commit 3cd737e

Browse files
committed
Overlay: Future-proof Java config discarding
1 parent 2cd1d2f commit 3cd737e

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

java/ql/lib/semmle/code/java/Overlay.qll

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,24 @@ private predicate discardReferableLocatable(@locatable el) {
7373
)
7474
}
7575

76+
/** Gets the raw file for a configLocatable. */
7677
overlay[local]
77-
private predicate baseConfigLocatable(@configLocatable l) { not isOverlay() and exists(l) }
78+
private string getRawFileForConfig(@configLocatable el) {
79+
exists(@location loc, @file file |
80+
configLocations(el, loc) and
81+
locations_default(loc, file, _, _, _, _) and
82+
files(file, result)
83+
)
84+
}
7885

7986
overlay[local]
80-
private predicate overlayHasConfigLocatables() {
81-
isOverlay() and
82-
exists(@configLocatable el)
87+
private string baseConfigLocatable(@configLocatable el) {
88+
not isOverlay() and result = getRawFileForConfig(el)
8389
}
8490

8591
overlay[discard_entity]
8692
private predicate discardBaseConfigLocatable(@configLocatable el) {
87-
// The properties extractor is currently not incremental, so if
88-
// the overlay contains any config locatables, the overlay should
89-
// contain a full extraction and all config locatables from base
90-
// should be discarded.
91-
baseConfigLocatable(el) and overlayHasConfigLocatables()
93+
overlayChangedFiles(baseConfigLocatable(el))
9294
}
9395

9496
overlay[local]

0 commit comments

Comments
 (0)