Is possible to implement a custom rule to identify if any caller is caching an annotated method data?
For example
publicclassMyCache{privatestaticMyCachei=newMyCache();privateMap<String>data;privateMyCache(){/* init data */}publicstaticMyCachegetInstance(){returni;}@NotCachablepublicMap<String>getData(){returndata;}}publicclassCaller1(){privateMap<String>data;publicvoidfoo(){//ERROR!this.data=MyCache.getInstance().getData();}}publicclassCaller2(){privateMap<String>updated;publicvoidfoo1(){//ERROR!Map<String>a=MyCache.getInstance().getData();this.updated=doSomething(a);//dosomethingondataandcacheaderivedvalue}publicvoidfoo2(){//OKMap<String>a=MyCache.getInstance().getData();System.out.println(a.get("a"));}}
My request is to search in all classpath if any caller of a method annotated with custom annotation (for example @NotCachable) is just using the data or recaching it in some way.
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is possible to implement a custom rule to identify if any caller is caching an annotated method data?
For example
My request is to search in all classpath if any caller of a method annotated with custom annotation (for example @NotCachable) is just using the data or recaching it in some way.
Thank you.