Skip to content

Commit 9e6eebb

Browse files
author
Stephan Brandauer
committed
Java: Automodel: drive-by: remove unused message logic for candidate extraction
1 parent 0d53600 commit 9e6eebb

File tree

4 files changed

+36
-53
lines changed

4 files changed

+36
-53
lines changed

java/ql/automodel/src/AutomodelApplicationModeExtractCandidates.ql

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ private Endpoint getSampleForSignature(
5555
}
5656

5757
from
58-
Endpoint endpoint, string message, ApplicationModeMetadataExtractor meta, DollarAtString package,
58+
Endpoint endpoint, ApplicationModeMetadataExtractor meta, DollarAtString package,
5959
DollarAtString type, DollarAtString subtypes, DollarAtString name, DollarAtString signature,
6060
DollarAtString input, DollarAtString output, DollarAtString isVarargsArray,
6161
DollarAtString alreadyAiModeled, DollarAtString extensibleType
6262
where
6363
not exists(CharacteristicsImpl::UninterestingToModelCharacteristic u |
6464
u.appliesToEndpoint(endpoint)
6565
) and
66+
CharacteristicsImpl::isSinkCandidate(endpoint, _) and
6667
endpoint =
6768
getSampleForSignature(9, package, type, subtypes, name, signature, input, output,
6869
isVarargsArray, extensibleType) and
@@ -78,19 +79,9 @@ where
7879
CharacteristicsImpl::isModeled(endpoint, _, _, alreadyAiModeled)
7980
) and
8081
meta.hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, isVarargsArray) and
81-
includeAutomodelCandidate(package, type, name, signature) and
82-
// The message is the concatenation of all sink types for which this endpoint is known neither to be a sink nor to be
83-
// a non-sink, and we surface only endpoints that have at least one such sink type.
84-
message =
85-
strictconcat(AutomodelEndpointTypes::SinkType sinkType |
86-
not CharacteristicsImpl::isKnownAs(endpoint, sinkType, _) and
87-
CharacteristicsImpl::isSinkCandidate(endpoint, sinkType)
88-
|
89-
sinkType, ", "
90-
)
82+
includeAutomodelCandidate(package, type, name, signature)
9183
select endpoint.asNode(),
92-
message + "\nrelated locations: $@, $@, $@." +
93-
"\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@, $@.", //
84+
"related locations: $@, $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@, $@.", //
9485
CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, CallContext()), "CallContext", //
9586
CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", //
9687
CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, ClassDoc()), "ClassDoc", //

java/ql/automodel/src/AutomodelFrameworkModeExtractCandidates.ql

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ private import AutomodelFrameworkModeCharacteristics
1616
private import AutomodelJavaUtil
1717

1818
from
19-
Endpoint endpoint, string message, FrameworkModeMetadataExtractor meta, DollarAtString package,
19+
Endpoint endpoint, FrameworkModeMetadataExtractor meta, DollarAtString package,
2020
DollarAtString type, DollarAtString subtypes, DollarAtString name, DollarAtString signature,
2121
DollarAtString input, DollarAtString output, DollarAtString parameterName,
2222
DollarAtString alreadyAiModeled, DollarAtString extensibleType
@@ -25,6 +25,7 @@ where
2525
not exists(CharacteristicsImpl::UninterestingToModelCharacteristic u |
2626
u.appliesToEndpoint(endpoint)
2727
) and
28+
CharacteristicsImpl::isSinkCandidate(endpoint, _) and
2829
// If a node is already a known sink for any of our existing ATM queries and is already modeled as a MaD sink, we
2930
// don't include it as a candidate. Otherwise, we might include it as a candidate for query A, but the model will
3031
// label it as a sink for one of the sink types of query B, for which it's already a known sink. This would result in
@@ -37,18 +38,9 @@ where
3738
CharacteristicsImpl::isSink(endpoint, _, alreadyAiModeled)
3839
) and
3940
meta.hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, parameterName) and
40-
includeAutomodelCandidate(package, type, name, signature) and
41-
// The message is the concatenation of all sink types for which this endpoint is known neither to be a sink nor to be
42-
// a non-sink, and we surface only endpoints that have at least one such sink type.
43-
message =
44-
strictconcat(AutomodelEndpointTypes::SinkType sinkType |
45-
not CharacteristicsImpl::isKnownAs(endpoint, sinkType, _) and
46-
CharacteristicsImpl::isSinkCandidate(endpoint, sinkType)
47-
|
48-
sinkType, ", "
49-
)
41+
includeAutomodelCandidate(package, type, name, signature)
5042
select endpoint,
51-
message + "\nrelated locations: $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@.", //
43+
"Related locations: $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@, $@.", //
5244
CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", //
5345
CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, ClassDoc()), "ClassDoc", //
5446
package, "package", //

0 commit comments

Comments
 (0)