Fix 'PsiElement.getReference()' contract for Kotlin PSI (KT-52822)

As stated in JavaDoc for 'PsiElement' (formatting is slightly changed):

Returns the reference from this PSI element to another PSI element
(or elements), if one exists. If the element has multiple associated
references, returns the first associated reference.
This commit is contained in:
Yan Zhulanow
2022-06-16 22:01:22 +09:00
committed by teamcity
parent 3a6dd52833
commit 191bac38a3
@@ -104,8 +104,7 @@ public class KtElementImplStub<T extends StubElement<?>> extends StubBasedPsiEle
@SuppressWarnings("deprecation")
public PsiReference getReference() {
PsiReference[] references = getReferences();
if (references.length == 1) return references[0];
else return null;
return (references.length > 0) ? references[0] : null;
}
@NotNull