- String name = myName;
-
- if (name == null) {
- PsiParameterStubImpl parameterStub = (PsiParameterStubImpl)getStub();
- if (!parameterStub.isAutoGeneratedName()) {
- name = parameterStub.getName();
- }
-
- if (name == null) {
- if (DumbService.getInstance(getProject()).isDumb()) {
- return null;
- }
-
- ClsMethodImpl method = (ClsMethodImpl)getDeclarationScope();
- PsiMethod sourceMethod = method.getSourceMirrorMethod();
- if (sourceMethod != null) {
- assert sourceMethod != method : method;
- name = sourceMethod.getParameterList().getParameters()[getIndex()].getName();
- }
- else {
- name = getMirrorName();
- }
+ return CachedValuesManager.getCachedValue(this, new CachedValueProvider<String>() {
+ @Nullable
+ @Override
+ public Result<String> compute() {
+ return Result.create(calcName(),
+ getContainingFile(),
+ getContainingFile().getNavigationElement(),
+ FileIndexFacade.getInstance(getProject()).getRootModificationTracker());