From 06215ca93210022c141b3f825c75dccb05fc9a6c Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Thu, 21 Jan 2016 15:57:51 +0300 Subject: [PATCH] Correctly avoid calculation of autogenerated parameter name in ClsParameterImpl.calcName() --- .../load/java/structure/impl/JavaValueParameterImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaValueParameterImpl.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaValueParameterImpl.java index f064a9840ed..ea82ef004e1 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaValueParameterImpl.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaValueParameterImpl.java @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.load.java.structure.impl; import com.intellij.psi.PsiAnnotationOwner; import com.intellij.psi.PsiParameter; import com.intellij.psi.impl.compiled.ClsParameterImpl; +import com.intellij.psi.impl.java.stubs.impl.PsiParameterStubImpl; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.Visibilities; @@ -85,7 +86,7 @@ public class JavaValueParameterImpl extends JavaElementImpl @Nullable public Name getName() { PsiParameter psi = getPsi(); - if (psi instanceof ClsParameterImpl && ((ClsParameterImpl) psi).isAutoGeneratedName()) { + if (isParameterWithAutoGeneratedName(psi)) { return null; } @@ -93,6 +94,11 @@ public class JavaValueParameterImpl extends JavaElementImpl return name == null ? null : Name.identifier(name); } + private static boolean isParameterWithAutoGeneratedName(PsiParameter psi) { + // see com.intellij.psi.impl.compiled.ClsParameterImpl.calcName() + return psi instanceof ClsParameterImpl && ((PsiParameterStubImpl) ((ClsParameterImpl) psi).getStub()).isAutoGeneratedName(); + } + @Override @NotNull public JavaType getType() {