Differentiate between type parameters and parameters (IDEA-226683)

PR#1243

GitOrigin-RevId: a91176d9f95e2803da7c1973c58ce4ee492fb703
This commit is contained in:
Daniel Schmidt
2019-11-19 17:44:24 +07:00
committed by intellij-monorepo-bot
parent f4ad3b5771
commit 909433482c
5 changed files with 27 additions and 1 deletions

View File

@@ -275,6 +275,9 @@ public class JavadocHighlightUtil {
PsiReference reference = value.getReference();
if (reference != null) {
String paramName = reference.getCanonicalText();
if(((PsiDocParamRef)value).isTypeParamRef()){
paramName = "<" + paramName + ">";
}
documentedParamNames = set(documentedParamNames);
if (documentedParamNames.contains(paramName)) {
holder.problem(tag.getNameElement(), InspectionsBundle.message("inspection.javadoc.problem.duplicate.param", paramName), null);

View File

@@ -0,0 +1,10 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
class Test {
/**
* Test. Don't report type param 'X' as duplicate of param 'X'.
*
* @param X my string
* @param <X> my type
*/
<X> X getValue(String X) {return null;}
}

View File

@@ -0,0 +1,11 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
class Test {
/**
* Test.
*
* @param X my string
* @param <X> my type
* <warning descr="Duplicate @param tag for parameter '<X>'">@param</warning> <X> another type
*/
<X> X getValue(String X) {return null;}
}

View File

@@ -103,7 +103,9 @@ public class JavadocHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testBadReference() { doTest(); }
public void testMissingReturnDescription() { doTest(); }
public void testDoubleParenthesesInCode() { doTest(); }
public void testDuplicateParam() { doTest(); }
public void testDuplicateParam0() { doTest(); }
public void testDuplicateParam1() { doTest(); }
public void testDuplicateParam2() { doTest(); }
public void testDuplicateReturn() { doTest(); }
public void testDuplicateDeprecated() { myInspection.IGNORE_DEPRECATED = false; doTest(); }
public void testDuplicateSerial() { doTest(); }