Make type parameter name be always notnull

Fix java.lang.AssertionError: @NotNull method org/jetbrains/jet/lang/resolve/lazy/descriptors/LazyTypeParameterDescriptor.getName must not return null
This commit is contained in:
Nikolay Krasko
2013-06-21 11:56:01 +04:00
parent 9167e4f1ee
commit c2e8282fb9
2 changed files with 4 additions and 3 deletions
@@ -243,7 +243,6 @@ public class ResolveSession implements KotlinCodeAnalyzer {
DeclarationDescriptor ownerDescriptor = resolveToDescriptor(ownerElement);
List<TypeParameterDescriptor> typeParameters;
Name name = parameter.getNameAsName();
if (ownerDescriptor instanceof CallableDescriptor) {
CallableDescriptor callableDescriptor = (CallableDescriptor) ownerDescriptor;
typeParameters = callableDescriptor.getTypeParameters();
@@ -256,6 +255,7 @@ public class ResolveSession implements KotlinCodeAnalyzer {
throw new IllegalStateException("Unknown owner kind for a type parameter: " + ownerDescriptor);
}
Name name = ResolveSessionUtils.safeNameForLazyResolve(parameter.getNameAsName());
for (TypeParameterDescriptor typeParameterDescriptor : typeParameters) {
if (typeParameterDescriptor.getName().equals(name)) {
return typeParameterDescriptor;
@@ -27,8 +27,9 @@ import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.lazy.LazyDescriptor;
import org.jetbrains.jet.lang.resolve.lazy.storage.NotNullLazyValue;
import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
import org.jetbrains.jet.lang.resolve.lazy.ResolveSessionUtils;
import org.jetbrains.jet.lang.resolve.lazy.storage.NotNullLazyValue;
import org.jetbrains.jet.lang.resolve.lazy.storage.StorageManager;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
@@ -69,7 +70,7 @@ public class LazyTypeParameterDescriptor implements TypeParameterDescriptor, Laz
this.variance = jetTypeParameter.getVariance();
this.containingDeclaration = containingDeclaration;
this.index = index;
this.name = jetTypeParameter.getNameAsName();
this.name = ResolveSessionUtils.safeNameForLazyResolve(jetTypeParameter.getNameAsName());
this.reified = jetTypeParameter.hasModifier(JetTokens.REIFIED_KEYWORD);
StorageManager storageManager = resolveSession.getStorageManager();