I am trying to check that strings passed to a method do not contain banned characters.
I can do this for String Literals, but I can’t figure out how to get the value from an IdentifierTree when it is a public static final String variable.
A bit more complex answer would be : we have done some effort in that direction that are not part of the API and on which you can get some inspiration (with no guarantee nor support) : have a look at ConstantUtils class in SonarJava source code.