See https://hibernate.zulipchat.com/#narrow/stream/132084-redhat-specific/topic/Hibernate.206.2E3.20RootGraph.2EappliesTo, such code is not safe to use if we want to preserve compatibility across more than one ORM version. ORM annotates packages/classes/methods with custom annotations to warn about incupating/internal/deprecated methods. Unfortunately We could probably take advantage of JQAssistant to forbid usage of such code, like we already do for implementation leaks inside Hibernate Search APIs. Getting method/field granularity might be annoying, though. Alternatively, we might be able to feed reports generated by Hibernate ORM to forbiddenapis:
I’m not sure the format is compatible though; the type of method parameters seems to be missing, and I believe forbiddenapis requires that. I may be wrong though; we need to check. |