AnnotationVisitor (int typeRef, TypePath typePath, String desc, boolean visible) { TypeReference ref = new TypeReference(typeRef); TypeInfo info = null; if (ref.getSort() == TypeReference.METHOD_RETURN) { info = myOwner.getReturnTypeText(); } else if (ref.getSort() == TypeReference.METHOD_FORMAL_PARAMETER) { int parameterIndex = ref.getFormalParameterIndex(); if (parameterIndex < myParamStubs.length) { info = myParamStubs[parameterIndex].getType(); } } else if (ref.getSort() == TypeReference.METHOD_TYPE_PARAMETER) { info = myMethodInfo.typeParameters.getParameterType(ref); } else if (ref.getSort() == TypeReference.METHOD_TYPE_PARAMETER_BOUND) { info = myMethodInfo.typeParameters.getBoundType(ref); } else if (ref.getSort() == TypeReference.THROWS) { int index = ref.getExceptionIndex(); if (index < myMethodInfo.throwTypes.size()) { info = myMethodInfo.throwTypes.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); }