Hacker News new | ask | show | jobs
by ivan_gammel 1098 days ago
I know this case. Indeed it adds some complexity in debugging and it does require that the user of such annotation understands how it works and what are the side effects. However this is probably the only case that causes so much trouble and it would deserve a dedicated compiler or IDE warning* for inexperienced engineers. There are many ways to shoot in the leg by using some tool or API incorrectly - it doesn’t mean the tool is bad.

*I would do it by introducing a new annotation:

   @ProxyImplementation
   public @interface Cacheable {}
Compiler can trigger a warning when a method invokes another method of the same class which is annotated with annotation marked as implemented by proxy.

Maybe Sonar or similar tool already does this kind of analysis.