java: .class parameter name calculation fixed

This commit is contained in:
Roman Shevchenko
2014-04-01 13:39:04 +02:00
parent 219c078b3b
commit 97d9377b6c
2 changed files with 12 additions and 5 deletions
@@ -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 {