From b9ffcab8f1e1d582dd078a2db221ba61a64cb874 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 25 Sep 2014 16:03:10 +0200 Subject: [PATCH] BaseExternalAnnotationsManager.markAsExternalAnnotation --- .../codeInsight/BaseExternalAnnotationsManager.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/BaseExternalAnnotationsManager.java b/java/java-psi-impl/src/com/intellij/codeInsight/BaseExternalAnnotationsManager.java index 0b0cd2f25c4b..29fbe6b7b0f0 100644 --- a/java/java-psi-impl/src/com/intellij/codeInsight/BaseExternalAnnotationsManager.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/BaseExternalAnnotationsManager.java @@ -366,8 +366,7 @@ public abstract class BaseExternalAnnotationsManager extends ExternalAnnotations PsiAnnotation a = annotation; if (a == null) { a = context.createAnnotationFromText("@" + annotationClassFqName + (annotationParameters.isEmpty() ? "" : "("+annotationParameters+")")); - a.putUserData(EXTERNAL_ANNO_MARKER, Boolean.TRUE); - annotation = a; + annotation = markAsExternalAnnotation(a); } return a; } @@ -390,6 +389,11 @@ public abstract class BaseExternalAnnotationsManager extends ExternalAnnotations } } + private static PsiAnnotation markAsExternalAnnotation(@NotNull PsiAnnotation annotation) { + annotation.putUserData(EXTERNAL_ANNO_MARKER, Boolean.TRUE); + return annotation; + } + @NotNull private PsiAnnotation createAnnotationFromText(@NotNull final String text) throws IncorrectOperationException { // synchronize during interning in charTable @@ -399,8 +403,7 @@ public abstract class BaseExternalAnnotationsManager extends ExternalAnnotations if (!(element instanceof PsiAnnotation)) { throw new IncorrectOperationException("Incorrect annotation \"" + text + "\"."); } - element.putUserData(EXTERNAL_ANNO_MARKER, Boolean.TRUE); - return (PsiAnnotation)element; + return markAsExternalAnnotation((PsiAnnotation)element); } } private static final JavaParserUtil.ParserWrapper ANNOTATION = new JavaParserUtil.ParserWrapper() {