mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java: .class parameter name calculation fixed
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,6 +64,7 @@ public class ClsParameterImpl extends ClsRepositoryPsiElement<PsiParameterStub>
|
||||
@Override
|
||||
public String getName() {
|
||||
String name = myName;
|
||||
|
||||
if (name == null) {
|
||||
if (DumbService.getInstance(getProject()).isDumb()) {
|
||||
return null;
|
||||
@@ -73,16 +74,19 @@ public class ClsParameterImpl extends ClsRepositoryPsiElement<PsiParameterStub>
|
||||
PsiMethod sourceMethod = method.getSourceMirrorMethod();
|
||||
if (sourceMethod != null) {
|
||||
assert sourceMethod != method : method;
|
||||
myName = name = sourceMethod.getParameterList().getParameters()[getIndex()].getName();
|
||||
name = sourceMethod.getParameterList().getParameters()[getIndex()].getName();
|
||||
}
|
||||
|
||||
if (name == null) {
|
||||
PsiParameterStubImpl parameterStub = (PsiParameterStubImpl)getStub();
|
||||
if (!parameterStub.isAutoGeneratedName()) {
|
||||
name = parameterStub.getName();
|
||||
}
|
||||
name = !parameterStub.isAutoGeneratedName() ? parameterStub.getName() : getMirrorName();
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
myName = name;
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -503,6 +503,9 @@ public class ClsRepositoryUseTest extends PsiTestCase {
|
||||
|
||||
assertNotNull(parameters[0].getModifierList());
|
||||
assertNotNull(parameters[1].getModifierList());
|
||||
|
||||
assertEquals("ints", parameters[0].getName());
|
||||
assertEquals("o", parameters[1].getName());
|
||||
}
|
||||
|
||||
public void testGenericClass() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user