Fix asmTypeForAnonymousClassOrNull(): it should not throw an exception if a class name isn't found
This commit is contained in:
@@ -116,7 +116,8 @@ public class CodegenBinding {
|
|||||||
public static Type asmTypeForAnonymousClass(@NotNull BindingContext bindingContext, @NotNull KtElement expression) {
|
public static Type asmTypeForAnonymousClass(@NotNull BindingContext bindingContext, @NotNull KtElement expression) {
|
||||||
Type result = asmTypeForAnonymousClassOrNull(bindingContext, expression);
|
Type result = asmTypeForAnonymousClassOrNull(bindingContext, expression);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
throw new IllegalStateException("Type must not be null: " + expression.getText());
|
throw new KotlinExceptionWithAttachments("Couldn't compute ASM type for expression")
|
||||||
|
.withAttachment("expression.kt", PsiUtilsKt.getElementTextWithContext(expression));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -143,8 +144,7 @@ public class CodegenBinding {
|
|||||||
return asmTypeForAnonymousClassOrNull(bindingContext, variableDescriptor);
|
return asmTypeForAnonymousClassOrNull(bindingContext, variableDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new KotlinExceptionWithAttachments("Couldn't compute ASM type for expression")
|
return null;
|
||||||
.withAttachment("expression.kt", PsiUtilsKt.getElementTextWithContext(expression));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
Reference in New Issue
Block a user