PatternAnnotation.getString() should only be field reads

This commit is contained in:
Owen Mansel-Chan
2026-02-13 22:41:20 +00:00
parent 106254b220
commit 953ff9f0d0

View File

@@ -182,7 +182,7 @@ class PatternAnnotation extends Annotation, RegexExecutionExpr::Range {
override Expr getString() {
// Annotation on field accessed by direct read - value of field will match regexp
result = this.getAnnotatedElement().(Field).getAnAccess()
result.(FieldRead).getField() = this.getAnnotatedElement()
or
// Annotation on field accessed by getter - value of field will match regexp
result.(MethodCall).getMethod().(GetterMethod).getField() = this.getAnnotatedElement()