From 38a1bb0e29b60d3e7c429801bb9c1f4d787b0dd0 Mon Sep 17 00:00:00 2001 From: Asger F Date: Fri, 28 Nov 2025 09:23:27 +0100 Subject: [PATCH] Use string instead of @file in XML discards --- .../lib/semmle/code/java/internal/OverlayXml.qll | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/java/ql/lib/semmle/code/java/internal/OverlayXml.qll b/java/ql/lib/semmle/code/java/internal/OverlayXml.qll index 5fed569c915..95d49f2d611 100644 --- a/java/ql/lib/semmle/code/java/internal/OverlayXml.qll +++ b/java/ql/lib/semmle/code/java/internal/OverlayXml.qll @@ -7,13 +7,14 @@ module; */ private predicate isOverlay() { databaseMetadata("isOverlay", "true") } -private @file getXmlFile(@xmllocatable locatable) { - exists(@location_default location | xmllocations(locatable, location) | - locations_default(location, result, _, _, _, _) +private string getXmlFile(@xmllocatable locatable) { + exists(@location_default location, @file file | xmllocations(locatable, location) | + locations_default(location, file, _, _, _, _) and + files(file, result) ) } -private @file getXmlFileInBase(@xmllocatable locatable) { +private string getXmlFileInBase(@xmllocatable locatable) { not isOverlay() and result = getXmlFile(locatable) } @@ -22,7 +23,7 @@ private @file getXmlFileInBase(@xmllocatable locatable) { * Holds if the given `file` was extracted as part of the overlay and was extracted by the HTML/XML * extractor. */ -private predicate overlayXmlExtracted(@file file) { +private predicate overlayXmlExtracted(string file) { isOverlay() and exists(@xmllocatable locatable | not files(locatable, _) and not xmlNs(locatable, _, _, _) and file = getXmlFile(locatable) @@ -35,8 +36,8 @@ private predicate overlayXmlExtracted(@file file) { */ overlay[discard_entity] private predicate discardXmlLocatable(@xmllocatable locatable) { - exists(@file file | file = getXmlFileInBase(locatable) | - exists(string path | files(file, path) | overlayChangedFiles(path)) + exists(string file | file = getXmlFileInBase(locatable) | + overlayChangedFiles(file) or // The HTML/XML extractor is currently not incremental and may extract more files than those // included in overlayChangedFiles.