So I'm currently writing some PMD custom rules for my code. I'm supposed to ban any use of the java.sql package but I don't know to solve it. I imagine I can just read the package documentation and ban all the functions one by one, but I suppose there is a better option. Any suggestions? Thanks
You can simply check for any type or import starting with 'java.sql.' as so:
/CompilationUnit/ImportDeclaration/Name[starts-with(@Image, 'java.sql.')]
| //ClassOrInterfaceType[starts-with(@Image, 'java.sql.')]
You can read on how to define your own XPath rule in the docs