I need to perform a static analysis of the program (use SootUp library, v.:1.2.0). I can’t retrieve the annotations of the class fields.
My custom annotation (Kotlin):
<code>package annotation
@Target(AnnotationTarget.FIELD)
@Retention(AnnotationRetention.RUNTIME)
annotation class StateVar(val value: String = "")
</code>
<code>package annotation
@Target(AnnotationTarget.FIELD)
@Retention(AnnotationRetention.RUNTIME)
annotation class StateVar(val value: String = "")
</code>
package annotation
@Target(AnnotationTarget.FIELD)
@Retention(AnnotationRetention.RUNTIME)
annotation class StateVar(val value: String = "")
My class with annotated field:
<code>class TrafficLight {
@field:StateVar("mode")
private var mode: Int = 0
...
}
</code>
<code>class TrafficLight {
@field:StateVar("mode")
private var mode: Int = 0
...
}
</code>
class TrafficLight {
@field:StateVar("mode")
private var mode: Int = 0
...
}
I need to retrieve this annotation:
<code>...
val sootClass = view.getClass(classType).get()
sootClass.fields // <-- empty annotation list (pic below)
</code>
<code>...
val sootClass = view.getClass(classType).get()
sootClass.fields // <-- empty annotation list (pic below)
</code>
...
val sootClass = view.getClass(classType).get()
sootClass.fields // <-- empty annotation list (pic below)
pic
Could you explain to me how to access such annotations using the SootUp? What is my mistake?
New contributor
Student is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.