<T> Annotation buildAnnotation(Class<T> type, final String args1, final String... args2) { Integer hash = (type.hashCode() * 31) + String.valueOf(args1).hashCode() + (31 * Arrays.toString(args2).hashCode()); Annotation out = annotationHashes.get(hash); if (out == null) { if (type == Boolean.class || type == boolean.class) { out = buildBooleanStringAnnotation(args1 == null ? null : new String[] {args1}, args2); } else { out = newFormatAnnotation(args1, args2); } annotationHashes.put(hash, out); } return out; }