mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-16 08:39:59 +07:00
do not insert initial method comments in delegate with default param value (IDEA-81106)
This commit is contained in:
+5
-7
@@ -65,16 +65,14 @@ public class DelegateWithDefaultParamValueIntentionAction extends PsiElementBase
|
||||
|
||||
private static PsiMethod generateMethodPrototype(PsiMethod method, PsiParameter param) {
|
||||
final PsiMethod prototype = (PsiMethod)method.copy();
|
||||
PsiCodeBlock body = prototype.getBody();
|
||||
final PsiCodeBlock body = prototype.getBody();
|
||||
final PsiCodeBlock emptyBody = JavaPsiFacade.getElementFactory(method.getProject()).createMethodFromText("void foo(){}", prototype).getBody();
|
||||
assert emptyBody != null;
|
||||
if (body != null) {
|
||||
for (PsiStatement psiStatement : body.getStatements()) {
|
||||
psiStatement.delete();
|
||||
}
|
||||
body.replace(emptyBody);
|
||||
} else {
|
||||
prototype.getModifierList().setModifierProperty(PsiModifier.ABSTRACT, false);
|
||||
body =
|
||||
(PsiCodeBlock)prototype
|
||||
.addBefore(JavaPsiFacade.getElementFactory(method.getProject()).createMethodFromText("void foo(){}", prototype).getBody(), null);
|
||||
prototype.addBefore(emptyBody, null);
|
||||
}
|
||||
final int parameterIndex = method.getParameterList().getParameterIndex(param);
|
||||
prototype.getParameterList().getParameters()[parameterIndex].delete();
|
||||
|
||||
Reference in New Issue
Block a user