void (PsiModifierListOwner owner, LongRangeSet fromType, String min, String max) { Project project = owner.getProject(); ExternalAnnotationsManager manager = ExternalAnnotationsManager.getInstance(project); manager.deannotate(owner, JETBRAINS_RANGE); min = min.trim(); max = max.trim(); Long minValue = parseValue(min, fromType, true); Long maxValue = parseValue(max, fromType, false); if (minValue == null || maxValue == null || minValue == fromType.min() && maxValue == fromType.max()) { return; } if (minValue == Long.MIN_VALUE) { min = CommonClassNames.JAVA_LANG_LONG + ".MIN_VALUE"; } if (minValue == Integer.MIN_VALUE) { min = CommonClassNames.JAVA_LANG_INTEGER + ".MIN_VALUE"; } if (maxValue == Long.MAX_VALUE) { max = CommonClassNames.JAVA_LANG_LONG + ".MAX_VALUE"; } if (maxValue == Integer.MAX_VALUE) { max = CommonClassNames.JAVA_LANG_INTEGER + ".MAX_VALUE"; } if (min.isEmpty()) { min = minValue.toString(); } if (max.isEmpty()) { max = maxValue.toString(); } PsiAnnotation mockAnno = JavaPsiFacade.getElementFactory(project).createAnnotationFromText( "@"+JETBRAINS_RANGE+"(from="+min+", to="+max+")", null); try { manager.annotateExternally(owner, JETBRAINS_RANGE, owner.getContainingFile(), mockAnno.getParameterList().getAttributes()); } catch (ExternalAnnotationsManager.CanceledConfigurationException ignored) {} DaemonCodeAnalyzer.getInstance(project).restart(); }