提交 a7aeba4e 编写于 作者: S Stepan Koltsov

JDR: do not crash if signature references nonexistent class

上级 3a3cbd53
......@@ -82,6 +82,7 @@ public abstract class JetTypeJetSignatureReader extends JetSignatureExceptionsAd
private ClassDescriptor classDescriptor;
private JetType errorType;
private boolean nullable;
private List<TypeProjection> typeArguments;
......@@ -122,7 +123,8 @@ public abstract class JetTypeJetSignatureReader extends JetSignatureExceptionsAd
}
if (this.classDescriptor == null) {
throw new IllegalStateException("class not found by name: " + ourName); // TODO: wrong exception
// TODO: report in to trace
this.errorType = ErrorUtils.createErrorType("class not found by name: " + ourName);
}
this.nullable = nullable;
this.typeArguments = new ArrayList<TypeProjection>();
......@@ -180,12 +182,21 @@ public abstract class JetTypeJetSignatureReader extends JetSignatureExceptionsAd
@Override
public void visitEnd() {
JetType jetType = new JetTypeImpl(
Collections.<AnnotationDescriptor>emptyList(),
classDescriptor.getTypeConstructor(),
nullable,
typeArguments,
classDescriptor.getMemberScope(typeArguments));
if ((errorType != null) == (classDescriptor != null)) {
throw new IllegalStateException("must initialize either errorType or classDescriptor");
}
JetType jetType;
if (errorType != null) {
jetType = errorType;
}
else {
jetType = new JetTypeImpl(
Collections.<AnnotationDescriptor>emptyList(),
classDescriptor.getTypeConstructor(),
nullable,
typeArguments,
classDescriptor.getMemberScope(typeArguments));
}
done(jetType);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册