Note that unusedLocation can raise an alert for used but inaccessible locations

This commit is contained in:
Chris Smowton
2022-01-19 14:52:12 +00:00
committed by Ian Lynagh
parent 920599fcf5
commit 20d56094ee

View File

@@ -16,6 +16,13 @@ Location backwardsLocation() {
result.getStartColumn() > result.getEndColumn()
}
// Normally a location should tag at least one locatable entity.
// Note this is not absolutely necessarily a bug (it does not always indicate a location is
// an orphan in database terms), because classes that are seen both as source code and as a
// .class file are extracted using both locations, with `Top.getLocation` filtering out the
// class-file location when both a source- and a class-file location are present in the
// database. However at present the Java extractor always uses the class-file location at
// least to locate a `File`, so such a location does end up with a single use.
Location unusedLocation() {
not exists(Top t | t.getLocation() = result) and
not exists(XMLLocatable x | x.getLocation() = result) and