Text blocks (added in Java 15) can be used anywhere you would expect a String literal. It makes sense for our rules to support this as well. As an example for RSPEC-5547, we can write code as follows:
While it does not make sense to support Text block in all possible situations (it is a huge effort with only little value because most of the time using a string literal makes more sense, and RSPEC-5663 will report an intermediate issue if needed), supporting it for rules relying on asConstant(String.class) is a quick win.
For these rules, we should make sure to report an issue independently of the way you declared the String.
In many rules, we rely on .asConstant(String.class) method to recover the value as a String from an expression. It's a powerful method since the expression can be a literal or an identifier from a final or effectively final variable. It makes sense to extend it to support returning the value of the text block. By doing this, we will transparently support text blocks in all rules relying on this method.