use of com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection in project intellij-community by JetBrains.
the class JavaDocCommentFixer method fixComment.
@Override
public void fixComment(@NotNull Project project, @NotNull Editor editor, @NotNull PsiComment comment) {
if (!(comment instanceof PsiDocComment)) {
return;
}
PsiDocComment docComment = (PsiDocComment) comment;
PsiJavaDocumentedElement owner = docComment.getOwner();
if (owner == null) {
return;
}
PsiFile file = comment.getContainingFile();
if (file == null) {
return;
}
JavaDocReferenceInspection referenceInspection = new JavaDocReferenceInspection();
JavaDocLocalInspection localInspection = getDocLocalInspection();
InspectionManager inspectionManager = InspectionManager.getInstance(project);
ProblemDescriptor[] referenceProblems = null;
ProblemDescriptor[] otherProblems = null;
if (owner instanceof PsiClass) {
referenceProblems = referenceInspection.checkClass(((PsiClass) owner), inspectionManager, false);
otherProblems = localInspection.checkClass(((PsiClass) owner), inspectionManager, false);
} else if (owner instanceof PsiField) {
referenceProblems = referenceInspection.checkField(((PsiField) owner), inspectionManager, false);
otherProblems = localInspection.checkField(((PsiField) owner), inspectionManager, false);
} else if (owner instanceof PsiMethod) {
referenceProblems = referenceInspection.checkMethod((PsiMethod) owner, inspectionManager, false);
otherProblems = localInspection.checkMethod((PsiMethod) owner, inspectionManager, false);
}
if (referenceProblems != null) {
fixReferenceProblems(referenceProblems, project);
}
if (otherProblems != null) {
fixCommonProblems(otherProblems, comment, editor.getDocument(), project);
}
PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument());
ensureContentOrdered(docComment, editor.getDocument());
locateCaret(docComment, editor, file);
}
use of com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection in project intellij-community by JetBrains.
the class JavadocHighlightingTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.HIGHEST);
myInspection = new JavaDocLocalInspection();
myInspection.setIgnoreDuplicatedThrows(false);
enableInspectionTools(myInspection, new JavaDocReferenceInspection());
}
use of com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection in project intellij-community by JetBrains.
the class RedundantSuppressTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
myInspectionToolWrappers = new InspectionToolWrapper[] { new LocalInspectionToolWrapper(new JavaDocReferenceInspection()), new LocalInspectionToolWrapper(new I18nInspection()), new LocalInspectionToolWrapper(new RawUseOfParameterizedTypeInspection()), new GlobalInspectionToolWrapper(new EmptyMethodInspection()), new GlobalInspectionToolWrapper(new UnusedDeclarationInspection()) };
myWrapper = new GlobalInspectionToolWrapper(new RedundantSuppressInspection() {
@NotNull
@Override
protected InspectionToolWrapper[] getInspectionTools(PsiElement psiElement, @NotNull InspectionManager manager) {
return myInspectionToolWrappers;
}
});
}
use of com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection in project intellij-community by JetBrains.
the class LightAdvHighlightingJdk9Test method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
enableInspectionTools(new UnusedDeclarationInspection(), new UncheckedWarningLocalInspection(), new RedundantCastInspection(), new JavaDocReferenceInspection());
setLanguageLevel(LanguageLevel.JDK_1_9);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_9, getModule(), getTestRootDisposable());
}
use of com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection in project intellij-community by JetBrains.
the class SuppressModuleInfoInspectionsTest method testModuleInfo.
public void testModuleInfo() {
// need to set jdk version here because it is not set correctly in the mock jdk which causes problems in
// com.intellij.codeInspection.JavaSuppressionUtil#canHave15Suppressions()
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_9, myFixture.getModule(), getTestRootDisposable());
final LocalInspectionTool inspection = new JavaDocReferenceInspection();
myFixture.enableInspections(inspection);
myFixture.configureByFile("module-info.java");
myFixture.testHighlighting();
myFixture.launchAction(myFixture.findSingleIntention("Suppress for module declaration"));
myFixture.checkResultByFile("module-info.after.java");
}
Aggregations