mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
java: "Add Javadoc" intention should not be available on local classes (IDEA-327296)
GitOrigin-RevId: c299d811b9e4a3f532003cc351531787c9574000
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d5e0643962
commit
b01b60a8a2
@@ -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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.intention.impl;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.FixDocCommentAction;
|
||||
@@ -11,6 +11,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -29,6 +30,9 @@ public class AddJavadocIntention extends BaseElementAtCaretIntentionAction imple
|
||||
if (targetElement instanceof PsiVariable && PsiTreeUtil.isAncestor(((PsiVariable)targetElement).getInitializer(), element, false)) {
|
||||
return false;
|
||||
}
|
||||
if ( targetElement instanceof PsiClass aClass && PsiUtil.isLocalClass(aClass)) {
|
||||
return false;
|
||||
}
|
||||
if (targetElement instanceof PsiJavaDocumentedElement &&
|
||||
!(targetElement instanceof PsiTypeParameter) &&
|
||||
!(targetElement instanceof PsiAnonymousClass)) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add Javadoc" "false"
|
||||
|
||||
class Test {
|
||||
|
||||
void x() {
|
||||
class <caret>Local {}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user