I am working on a simple tool to check Java coding guidelines on a project.
One of those guidelines is to verify that there is no variable declared like “private static …”, only “private static final …” is allowed.
I am wondering how I can get this result. I wrote this one:
pattern = "private\\\s*static\\\s*(?!final)";
But it is not working. How can I get only the entries without the “final” keyword?
Thanks,
Med.
That should work, yes. You might want to move the second whitespace inside the lookahead: