Skip to content

Commit 85f519b

Browse files
author
Stephan Brandauer
committed
documentation updates from review comments
1 parent 94cb82e commit 85f519b

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

java/ql/src/Telemetry/AutomodelFrameworkModeCharacteristics.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ abstract class MetadataExtractor extends string {
3131
);
3232
}
3333

34+
// for documentation of the implementations here, see the QLDoc in the CandidateSig signature module.
3435
module FrameworkCandidatesImpl implements SharedCharacteristics::CandidateSig {
3536
class Endpoint = DataFlow::ParameterNode;
3637

@@ -101,6 +102,11 @@ module FrameworkCandidatesImpl implements SharedCharacteristics::CandidateSig {
101102
exists(int paramIdx | e.isParameterOf(_, paramIdx) | input = "Argument[" + paramIdx + "]")
102103
}
103104

105+
/**
106+
* Returns the related location for the given endpoint.
107+
*
108+
* Related locations can be JavaDoc comments of the class or the method.
109+
*/
104110
RelatedLocation getRelatedLocation(Endpoint e, string name) {
105111
name = "Callable-JavaDoc" and
106112
result = FrameworkCandidatesImpl::getCallable(e).(Documentable).getJavadoc()

java/ql/src/Telemetry/AutomodelSharedCharacteristics.qll

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ signature module CandidateSig {
5555
*/
5656
predicate isNeutral(Endpoint e);
5757

58+
/**
59+
* A related location is a source code location that may hold extra information about an endpoint that can be useful
60+
* to the machine learning model.
61+
*
62+
* For example, a related location for a method call may be the documentation comment of a method.
63+
*/
5864
RelatedLocation getRelatedLocation(Endpoint e, string name);
5965
}
6066

@@ -95,8 +101,8 @@ module SharedCharacteristics<CandidateSig Candidate> {
95101
}
96102

97103
/**
98-
* If it exists, gets a related location for a given endpoint or candidate.
99-
* If it doesn't exist, returns the candidate itself as a 'null' value.
104+
* Gets the related location of `e` with name `name`, if it exists.
105+
* Otherwise, gets the candidate itself.
100106
*/
101107
bindingset[name]
102108
Candidate::RelatedLocation getRelatedLocationOrCandidate(Candidate::Endpoint e, string name) {
@@ -115,8 +121,8 @@ module SharedCharacteristics<CandidateSig Candidate> {
115121
// An endpoint is a sink candidate if none of its characteristics give much indication whether or not it is a sink.
116122
not sinkType instanceof Candidate::NegativeEndpointType and
117123
result.appliesToEndpoint(candidateSink) and
118-
// Exclude endpoints that have a characteristic that implies they're not sinks for _any_ sink type.
119124
(
125+
// Exclude endpoints that have a characteristic that implies they're not sinks for _any_ sink type.
120126
exists(float confidence |
121127
confidence >= mediumConfidence() and
122128
result.hasImplications(any(Candidate::NegativeEndpointType t), true, confidence)
@@ -144,8 +150,7 @@ module SharedCharacteristics<CandidateSig Candidate> {
144150
EndpointCharacteristic() { any() }
145151

146152
/**
147-
* Holds for parameters that have this characteristic. This predicate contains the logic that applies characteristics
148-
* to the appropriate set of dataflow parameters.
153+
* Holds for endpoints that have this characteristic.
149154
*/
150155
abstract predicate appliesToEndpoint(Candidate::Endpoint n);
151156

0 commit comments

Comments
 (0)