Skip to content

Commit 6a63b86

Browse files
committed
Java: Member.getQualifiedName() tweaked
It now includes the qualified name of the declaring type.
1 parent fc44573 commit 6a63b86

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The `Member.getQualifiedName()` predicate result now includes the qualified name of the declaring type.

java/ql/lib/semmle/code/java/Member.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ class Member extends Element, Annotatable, Modifiable, @member {
2020
/** Gets the type in which this member is declared. */
2121
RefType getDeclaringType() { declaresMember(result, this) }
2222

23-
/** Gets the qualified name of this member. */
24-
string getQualifiedName() { result = this.getDeclaringType().getName() + "." + this.getName() }
23+
/**
24+
* Gets the qualified name of this member.
25+
* This is useful for debugging, but for normal use `hasQualifiedName`
26+
* is recommended, as it is more efficient.
27+
*/
28+
string getQualifiedName() { result = this.getDeclaringType().getQualifiedName() + "." + this.getName() }
2529

2630
/**
2731
* Holds if this member has the specified name and is declared in the

java/ql/lib/semmle/code/java/security/ExternalAPIs.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ class ExternalApiDataNode extends DataFlow::Node {
9393

9494
/** Gets the description of the method being called. */
9595
string getMethodDescription() {
96-
result =
97-
this.getMethod().getDeclaringType().getPackage() + "." + this.getMethod().getQualifiedName()
96+
result = this.getMethod().getQualifiedName()
9897
}
9998
}
10099

0 commit comments

Comments
 (0)