From \https://groups.google.com/forum/#!topic/sonarqube/YGMsyzSkeQk:
In the past we've used a PMD XPath rule that looks like this "//MethodDeclaration//PrimaryExpression/PrimaryPrefix/Name[@Image='JAXBContext.newInstance'][ancestor::ClassOrInterfaceBodyDeclaration/Annotation/descendant::Name[contains(@Image,'SCOPE_PROTOTYPE')] or not(ancestor::ClassOrInterfaceBodyDeclaration/Annotation/descendant::Name[@Image='Bean'])]"