Skip to content

Commit 5a47e1d

Browse files
committed
Annotate generated static proxy methods as compiler-generated
1 parent 466cf75 commit 5a47e1d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ open class KotlinFileExtractor(
490490
// but suppress outputting the body, which we will replace with a delegating call below.
491491
forceExtractFunction(f, classId, extractBody = false, extractMethodAndParameterTypeAccesses = extractFunctionBodies, typeSubstitution = null, classTypeArgsIncludingOuterClasses = listOf(), idOverride = proxyFunctionId, locOverride = null)
492492
addModifiers(proxyFunctionId, "static")
493+
tw.writeCompiler_generated(proxyFunctionId, CompilerGeneratedKinds.JVMSTATIC_PROXY_METHOD.kind)
493494
if (extractFunctionBodies) {
494495
val realFunctionLocId = tw.getLocation(f)
495496
extractExpressionBody(proxyFunctionId, realFunctionLocId).also { returnId ->
@@ -4537,5 +4538,6 @@ open class KotlinFileExtractor(
45374538
ENUM_CLASS_SPECIAL_MEMBER(5),
45384539
DELEGATED_PROPERTY_GETTER(6),
45394540
DELEGATED_PROPERTY_SETTER(7),
4541+
JVMSTATIC_PROXY_METHOD(8),
45404542
}
45414543
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ class Element extends @element, Top {
5757
i = 4 and result = "Class initialisation method <clinit>"
5858
or
5959
i = 5 and result = "Enum class special member"
60+
or
61+
i = 6 and result = "Getter for a Kotlin delegated property"
62+
or
63+
i = 7 and result = "Setter for a Kotlin delegated property"
64+
or
65+
i = 8 and result = "Proxy static method for a @JvmStatic-annotated function or property"
6066
)
6167
}
6268
}

0 commit comments

Comments
 (0)