UAST: introduce UField.sourceAnnotations

and apply it to existing inspections that rely on annotations on
property w/o use-sites (which technically don't belong to UField). #KTIJ-33663

GitOrigin-RevId: 2ff1de00976104ae33beed0b71e544354c7de606
This commit is contained in:
Jinseong Jeon
2025-05-23 23:19:58 -07:00
committed by intellij-monorepo-bot
parent 8e4ffb351b
commit b4352ad4f8
7 changed files with 77 additions and 17 deletions

View File

@@ -19,9 +19,9 @@ class <error descr="Scheduled for removal API must also be marked with '@Depreca
@Deprecated("reason")
class NoWarnings {
// @ApiStatus.ScheduledForRemoval
// @Deprecated("reason") // not applicable to backing field
// val field: Int = 0;
@ApiStatus.ScheduledForRemoval
@Deprecated("reason")
val field: Int = 0
@ApiStatus.ScheduledForRemoval
@Deprecated("reason")

View File

@@ -3,13 +3,13 @@
import javax.annotation.Tainted
import javax.annotation.Untainted
@field:Tainted
@Tainted
val dirty: String = ""
@field:Untainted
@Untainted
var clean: String = <warning descr="Unsafe string is used in a safe context">dirty</warning> //warn
@field:Untainted
@Untainted
var clean2: String = ""
class SinkTestKotlin {
@@ -19,13 +19,13 @@ class SinkTestKotlin {
}
companion object {
@field:Tainted
@Tainted
val dirty: String = ""
@field:Untainted
@Untainted
var clean: String = <warning descr="Unsafe string is used in a safe context">dirty</warning> //warn
@field:Untainted
@Untainted
var clean2: String = ""
fun breakClean2(dirty: String) {
@@ -53,7 +53,7 @@ class SinkTestKotlin {
clear2 = dirty
}
@field:Untainted
@Untainted
var dirty: String? = <warning descr="Unsafe string is used in a safe context">getFromStatic()</warning> //warn
@Tainted
@@ -61,7 +61,7 @@ class SinkTestKotlin {
return ""
}
@field:Untainted
@Untainted
var clear: String? = ""
fun spoil(dirty: String?) {