diff options
Diffstat (limited to 'java/java-impl/src/com/intellij/codeInsight')
-rw-r--r-- | java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java | 2 | ||||
-rw-r--r-- | java/java-impl/src/com/intellij/codeInsight/hint/api/impls/AnnotationParameterInfoHandler.java | 15 |
2 files changed, 11 insertions, 6 deletions
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java index f33c6e4a394a..15e6d5a04d9f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java @@ -255,7 +255,7 @@ public class OverrideImplementUtil extends OverrideImplementExploreUtil { for (OverrideImplementsAnnotationsHandler each : Extensions.getExtensions(OverrideImplementsAnnotationsHandler.EP_NAME)) { for (String annotation : each.getAnnotations(project)) { if (moduleScope != null && facade.findClass(annotation, moduleScope) == null) continue; - if (AnnotationUtil.isAnnotated(overridden, annotation, false, false)) { + if (AnnotationUtil.isAnnotated(overridden, annotation, false, false) && !AnnotationUtil.isAnnotated(method, annotation, false, false)) { AddAnnotationPsiFix.removePhysicalAnnotations(method, each.annotationsToRemove(project, annotation)); AddAnnotationPsiFix.addPhysicalAnnotation(annotation, PsiNameValuePair.EMPTY_ARRAY, method.getModifierList()); } diff --git a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/AnnotationParameterInfoHandler.java b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/AnnotationParameterInfoHandler.java index b3434ac20c10..9646ef9983ad 100644 --- a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/AnnotationParameterInfoHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/AnnotationParameterInfoHandler.java @@ -21,6 +21,7 @@ import com.intellij.openapi.project.DumbAware; import com.intellij.psi.*; import com.intellij.psi.util.PsiUtil; import com.intellij.util.text.CharArrayUtil; +import com.intellij.xml.util.XmlStringUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -110,14 +111,18 @@ public class AnnotationParameterInfoHandler implements ParameterInfoHandler<PsiA @Override public void updateUI(final PsiAnnotationMethod p, final ParameterInfoUIContext context) { - @NonNls StringBuffer buffer = new StringBuffer(); + updateUIText(p, context); + } + + public static String updateUIText(PsiAnnotationMethod p, ParameterInfoUIContext context) { + @NonNls StringBuilder buffer = new StringBuilder(); int highlightStartOffset; int highlightEndOffset; buffer.append(p.getReturnType().getPresentableText()); buffer.append(" "); - highlightStartOffset = buffer.length(); + highlightStartOffset = XmlStringUtil.escapeString(buffer.toString()).length(); buffer.append(p.getName()); - highlightEndOffset = buffer.length(); + highlightEndOffset = XmlStringUtil.escapeString(buffer.toString()).length(); buffer.append("()"); if (p.getDefaultValue() != null) { @@ -125,8 +130,8 @@ public class AnnotationParameterInfoHandler implements ParameterInfoHandler<PsiA buffer.append(p.getDefaultValue().getText()); } - context.setupUIComponentPresentation(buffer.toString(), highlightStartOffset, highlightEndOffset, false, p.isDeprecated(), - false, context.getDefaultParameterColor()); + return context.setupUIComponentPresentation(buffer.toString(), highlightStartOffset, highlightEndOffset, false, p.isDeprecated(), + false, context.getDefaultParameterColor()); } private static PsiAnnotationMethod findAnnotationMethod(PsiFile file, int offset) { |