@@ -183,14 +183,26 @@ class Callable extends StmtParent, Member, @callable {
183
183
Type getParameterType ( int n ) { params ( _, result , n , this , _) }
184
184
185
185
/**
186
- * Gets the signature of this callable, including its name and the types of all its parameters,
187
- * identified by their simple (unqualified) names.
186
+ * Gets the signature of this callable, including its name and the types of all
187
+ * its parameters, identified by their simple (unqualified) names.
188
+ *
189
+ * The format of the string is `<name><params>`, where `<name>` is the result of
190
+ * the predicate `getName()` and `<params>` is the result of `paramsString()`.
191
+ * For example, the method `void printf(java.lang.String, java.lang.Object...)`
192
+ * has the string signature `printf(String, Object[])`.
188
193
*
189
194
* Use `getSignature` to obtain a signature including fully qualified type names.
190
195
*/
191
196
string getStringSignature ( ) { result = this .getName ( ) + this .paramsString ( ) }
192
197
193
- /** Gets a parenthesized string containing all parameter types of this callable, separated by a comma. */
198
+ /**
199
+ * Gets a parenthesized string containing all parameter types of this callable,
200
+ * separated by a comma and space. For the parameter types the unqualified string
201
+ * representation is used. If this callable has no parameters, the result is `()`.
202
+ *
203
+ * For example, the method `void printf(java.lang.String, java.lang.Object...)`
204
+ * has the params string `(String, Object[])`.
205
+ */
194
206
pragma [ nomagic]
195
207
string paramsString ( ) {
196
208
exists ( int n | n = getNumberOfParameters ( ) |
@@ -210,7 +222,12 @@ class Callable extends StmtParent, Member, @callable {
210
222
n > 0 and result = paramUpTo ( n - 1 ) + ", " + getParameterType ( n )
211
223
}
212
224
213
- /** Holds if this callable has the specified string signature. */
225
+ /**
226
+ * Holds if this callable has the specified string signature.
227
+ *
228
+ * This predicate simply tests if `sig` is equal to the result of the
229
+ * `getStringSignature()` predicate.
230
+ */
214
231
predicate hasStringSignature ( string sig ) { sig = this .getStringSignature ( ) }
215
232
216
233
/** Gets an exception that occurs in the `throws` clause of this callable. */
@@ -250,8 +267,10 @@ class Callable extends StmtParent, Member, @callable {
250
267
251
268
/**
252
269
* Gets the signature of this callable, where all types in the signature have a fully-qualified name.
270
+ * The parameter types are only separated by a comma (without space). If this callable has
271
+ * no parameters, the callable name is followed by `()`.
253
272
*
254
- * For example, method `void m(String s)` has the signature `m(java.lang.String)`.
273
+ * For example, method `void m(String s, int i )` has the signature `m(java.lang.String,int )`.
255
274
*/
256
275
string getSignature ( ) {
257
276
constrs ( this , _, result , _, _, _) or
0 commit comments