mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ensure name when retrieving constructors from a class (IDEA-188068)
This commit is contained in:
@@ -70,7 +70,7 @@ public class PsiImplUtil {
|
||||
public static PsiMethod[] getConstructors(@NotNull PsiClass aClass) {
|
||||
List<PsiMethod> result = null;
|
||||
for (PsiMethod method : aClass.getMethods()) {
|
||||
if (method.isConstructor()) {
|
||||
if (method.isConstructor() && method.getName().equals(aClass.getName())) {
|
||||
if (result == null) result = ContainerUtil.newSmartList();
|
||||
result.add(method);
|
||||
}
|
||||
|
||||
@@ -503,8 +503,8 @@ public class PsiClassImpl extends JavaStubPsiElement<PsiClassStub<?>> implements
|
||||
}
|
||||
|
||||
// rename constructors
|
||||
for (PsiMethod method : getConstructors()) {
|
||||
if (method.getName().equals(oldName)) {
|
||||
for (PsiMethod method : getMethods()) {
|
||||
if (method.isConstructor() && method.getName().equals(oldName)) {
|
||||
method.setName(newName);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Add constructor parameter" "true"
|
||||
class A {
|
||||
class Foo {
|
||||
private final String text;
|
||||
|
||||
public Foo(String text) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Add constructor parameter" "true"
|
||||
class A {
|
||||
class Foo {
|
||||
private final String te<caret>xt;
|
||||
|
||||
public Foo(String text) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Initialize in constructor" "true"
|
||||
class A {
|
||||
class Main {
|
||||
private final int var;
|
||||
|
||||
private Main() {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Initialize in constructor" "true"
|
||||
class A {
|
||||
class Main {
|
||||
private final int var;
|
||||
|
||||
private Main() {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Initialize in constructor" "true"
|
||||
class A {
|
||||
class Main {
|
||||
private final int var;
|
||||
|
||||
private Main(int var) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Initialize in constructor" "true"
|
||||
class A {
|
||||
class Main {
|
||||
private final int var;
|
||||
|
||||
private Main() {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Initialize in constructor" "true"
|
||||
class A {
|
||||
class Main {
|
||||
private final int v<caret>ar;
|
||||
|
||||
private Main()
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Initialize in constructor" "true"
|
||||
class A {
|
||||
class Main {
|
||||
private final int v<caret>ar;
|
||||
|
||||
private Main() {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Initialize in constructor" "true"
|
||||
class A {
|
||||
class Main {
|
||||
private final int v<caret>ar;
|
||||
|
||||
private Main(int var) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Initialize in constructor" "true"
|
||||
class A {
|
||||
class Main {
|
||||
private final int v<caret>ar;
|
||||
|
||||
private Main() {
|
||||
|
||||
Reference in New Issue
Block a user