AnnotationVisitor (int typeRef, TypePath typePath, String desc, boolean visible) { TypeReference ref = new TypeReference(typeRef); TypeInfo info = null; if (ref.getSort() == TypeReference.CLASS_TYPE_PARAMETER_BOUND) { info = myClassInfo.typeParameters.getBoundType(ref); } else if (ref.getSort() == TypeReference.CLASS_TYPE_PARAMETER) { info = myClassInfo.typeParameters.getParameterType(ref); } else if (ref.getSort() == TypeReference.CLASS_EXTENDS) { int index = ref.getSuperTypeIndex(); if (index == -1) { info = myClassInfo.superType; } else if (index >= 0 && index < myClassInfo.interfaces.size()) { info = myClassInfo.interfaces.get(index); } } if (info == null) return null; if (myAnnoBuilders == null) { myAnnoBuilders = new HashMap<>(); } return myAnnoBuilders.computeIfAbsent(info, typeInfo -> new ClsTypeAnnotationCollector(typeInfo, myFirstPassData)) .collect(typePath, desc); }