NlsInfo (UElement parent, AnnotationContext context) { NlsInfo info = fromType(context.getType()); if (info != NlsUnspecified.UNKNOWN) return info; PsiModifierListOwner owner = context.getOwner(); if (owner == null) return NlsUnspecified.UNKNOWN; info = fromAnnotationOwner(owner.getModifierList()); if (info != NlsUnspecified.UNKNOWN) return info; if (owner instanceof PsiParameter parameter) { if (parameter.isVarArgs() && context.getType() instanceof PsiEllipsisType) { info = fromType(((PsiEllipsisType)context.getType()).getComponentType()); } } else if (owner instanceof PsiVariable) { ULocalVariable uLocal = UastContextKt.toUElement(owner, ULocalVariable.class); if (uLocal != null) { info = fromUVariable(uLocal); } } if (info.getKind() != RestrictionInfoKind.KNOWN) { info = context.secondaryItems().map(item -> fromAnnotationOwner(item.getModifierList())) .filter(inf -> inf != NlsUnspecified.UNKNOWN).findFirst().orElse(info); } if (info == NlsUnspecified.UNKNOWN) { PsiMember member = ObjectUtils.tryCast(owner instanceof PsiParameter ? ((PsiParameter)owner).getDeclarationScope() : owner, PsiMember.class); if (member != null) { info = fromContainer(member); } } if (info == NlsUnspecified.UNKNOWN && (!(parent instanceof UCallExpression) || owner instanceof PsiParameter)) { info = new NlsUnspecified(owner); } return info; }