mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
[java] returns type parameter name to "missing tag" warning
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 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.
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.codeInspection.javaDoc;
|
||||
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
@@ -323,14 +323,14 @@ public class JavadocHighlightUtil {
|
||||
});
|
||||
}
|
||||
|
||||
static void checkMissingTypeParamTags(@NotNull PsiTypeParameterListOwner parameterListOwner,
|
||||
static void checkMissingTypeParamTags(@NotNull PsiTypeParameterListOwner owner,
|
||||
@NotNull PsiDocTag[] tags,
|
||||
@NotNull PsiElement toHighlight,
|
||||
@NotNull ProblemHolder holder) {
|
||||
if (parameterListOwner.hasTypeParameters()) {
|
||||
if (owner.hasTypeParameters()) {
|
||||
List<PsiTypeParameter> absentParameters = null;
|
||||
|
||||
for (PsiTypeParameter typeParameter : parameterListOwner.getTypeParameters()) {
|
||||
for (PsiTypeParameter typeParameter : owner.getTypeParameters()) {
|
||||
if (!hasTagForParameter(tags, typeParameter)) {
|
||||
(absentParameters = list(absentParameters)).add(typeParameter);
|
||||
}
|
||||
@@ -338,8 +338,12 @@ public class JavadocHighlightUtil {
|
||||
|
||||
if (absentParameters != null) {
|
||||
for (PsiTypeParameter typeParameter : absentParameters) {
|
||||
String message = InspectionsBundle.message("inspection.javadoc.problem.missing.tag", "<code>@param</code>");
|
||||
holder.problem(toHighlight, message, holder.addMissingTagFix("param", "<" + typeParameter.getName() + ">"));
|
||||
String name = typeParameter.getName();
|
||||
if (name != null) {
|
||||
String tagText = "<code><" + name + "></code>";
|
||||
String message = InspectionsBundle.message("inspection.javadoc.method.problem.missing.param.tag", tagText);
|
||||
holder.problem(toHighlight, message, holder.addMissingTagFix("param", "<" + name + ">"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class Test {
|
||||
|
||||
<warning descr="Required tag '@param' is missing">/**</warning>
|
||||
<warning descr="Required tag '@param' is missing for parameter '<T>'">/**</warning>
|
||||
* period.
|
||||
*/
|
||||
public <T> void f() {}
|
||||
|
||||
Reference in New Issue
Block a user