From fcf70fda2222b045447e5d337dbd700285c74b62 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Fri, 17 Mar 2017 15:08:34 +0300 Subject: [PATCH] Fix exception when classes erroneously have no name #KT-16775 Fixed Exception appears because of different representation of classes without name. For Kotlin we load them with `SpecialNames.NO_NAME_PROVIDED`, but for Java (for light classes) with `SpecialNames.safeIdentifier` --- .../kotlin/load/java/structure/impl/JavaClassImpl.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt index 7461e881c1f..40d13fff624 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2017 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. @@ -24,7 +24,7 @@ import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.load.java.structure.* import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.name.SpecialNames +import org.jetbrains.kotlin.psi.KtPsiUtil class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl(psiClass), JavaClass, JavaAnnotationOwnerImpl, JavaModifierListOwnerImpl { init { @@ -45,7 +45,7 @@ class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl(psiClass) } override val name: Name - get() = SpecialNames.safeIdentifier(psi.name) + get() = KtPsiUtil.safeName(psi.name) override val isInterface: Boolean get() = psi.isInterface