mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
create constructor matching super: insert braces when no present (IDEA-77194)
This commit is contained in:
@@ -112,6 +112,10 @@ public class CreateConstructorMatchingSuperFix extends BaseIntentionAction {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (targetClass.getLBrace() == null) {
|
||||
PsiClass psiClass = JavaPsiFacade.getInstance(targetClass.getProject()).getElementFactory().createClass("X");
|
||||
targetClass.addRangeAfter(psiClass.getLBrace(), psiClass.getRBrace(), targetClass.getLastChild());
|
||||
}
|
||||
PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
|
||||
CodeStyleManager reformatter = CodeStyleManager.getInstance(project);
|
||||
PsiMethod derived = null;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Create constructor matching super" "true"
|
||||
public class Test<T> {
|
||||
Test (T t) {}
|
||||
}
|
||||
|
||||
class Derived extends Test<String> {
|
||||
Derived(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Create constructor matching super" "true"
|
||||
public class Test<T> {
|
||||
Test (T t) {}
|
||||
}
|
||||
|
||||
class <caret>Derived extends Test<String>
|
||||
Reference in New Issue
Block a user