Skip to content

Commit fcb2f10

Browse files
committed
Java: Fix external API name for nested types
This fixes the name of reported external APIs for nested types. The `toString()` method of `getSourceDeclaration()` would report the name of a type, but not the name of the enclosing type. This results in missing information in the `UnsupportedExternalAPIs.ql` query. For example, previously it would report: ``` org.zapodot.junit.db.Builder#build() ``` However, the `Builder` class does not exist in the package and is only a nested type within `EmbeddedDatabaseRule`. The correct name should be: ``` org.zapodot.junit.db.EmbeddedDatabaseRule$Builder#build() ``` This name also matches the format of MaD.
1 parent 085c85f commit fcb2f10

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

java/ql/src/Telemetry/ExternalApi.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class ExternalApi extends Callable {
2727
*/
2828
string getApiName() {
2929
result =
30-
this.getDeclaringType().getPackage() + "." + this.getDeclaringType().getSourceDeclaration() +
31-
"#" + this.getName() + paramsString(this)
30+
this.getDeclaringType().getPackage() + "." + this.getDeclaringType().nestedName() + "#" +
31+
this.getName() + paramsString(this)
3232
}
3333

3434
private string getJarName() {

0 commit comments

Comments
 (0)