diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocUtil.java b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocUtil.java index bf3960ff4d3c..1996f089d06e 100644 --- a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocUtil.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.javadoc; import com.intellij.openapi.diagnostic.Logger; @@ -30,6 +30,7 @@ public final class JavaDocUtil { private static final Logger LOG = Logger.getInstance(JavaDocUtil.class); @NonNls private static final Pattern ourTypePattern = Pattern.compile("[ ]+[^ ^\\[^\\]]"); + private static final String JAVA_LANG = "java.lang."; private JavaDocUtil() { } @@ -303,9 +304,10 @@ public final class JavaDocUtil { catch (IndexNotReadyException e) { LOG.debug(e); } - return manager.areElementsEquivalent(aClass, resolvedClass) - ? shortName - : StringUtil.trimStart(qName, "java.lang."); + if (manager.areElementsEquivalent(aClass, resolvedClass)) { + return shortName; + } + return JAVA_LANG.length() + shortName.length() == qName.length() ? StringUtil.trimStart(qName, JAVA_LANG) : qName; } public static String getLabelText(Project project, PsiManager manager, String refText, PsiElement context) { diff --git a/java/java-tests/testData/codeInsight/javadocIG/reflectConstructor.html b/java/java-tests/testData/codeInsight/javadocIG/reflectConstructor.html new file mode 100644 index 000000000000..3912ed17a6b1 --- /dev/null +++ b/java/java-tests/testData/codeInsight/javadocIG/reflectConstructor.html @@ -0,0 +1,5 @@ +
@CallerSensitive +@NotNull+@ Contract(pure = true)+public java.lang.reflect.Constructor<?>[] getDeclaredConstructors() +throwsSecurityException
Throws: |