| Application should always use non-prefixed region names (as in the case of Statistics). The method would look like getSecondLevelCacheStatistics(@Unqualified String regionName). The checker should warn upon assignment from @Unqualified String to String or @Qualified String without an explicit cast. Assignment from String to @Unqualified String should be fine, so the uses of the API above don't need anything new. Internally, CacheImplementor.getQueryCache would carry on the annotated strings up to
@Qualified String qualifyRegionName(@Unqualified String regionName) {
return cacheRegionPrefix + (String) regionName; }
I have not checked if Checker Framework supports all steps in here (e.g. requiring that if a class implements method from interface with annotated parameters, the implementation has the parameter annotated as well), but this is the idea. |