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

work around javac bug, fix tests

上级 23f4f80a
......@@ -550,9 +550,6 @@ public class JetTypeMapper {
signatureVisitor.writeClassBound();
for (JetType jetType : typeParameterDescriptor.getUpperBounds()) {
if (jetType.equals(JetStandardClasses.getNullableAnyType())) {
continue;
}
if (jetType.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor) {
if (!CodegenUtil.isInterface(jetType)) {
mapType(jetType, signatureVisitor);
......@@ -561,7 +558,10 @@ public class JetTypeMapper {
}
}
// "extends Object" seems to be not optional according to ClassFileFormat-Java5.pdf
// "extends Object" is optional according to ClassFileFormat-Java5.pdf
// but javac complaints to signature:
// <P:>Ljava/lang/Object;
// TODO: avoid writing java/lang/Object if interface list is not empty
}
signatureVisitor.writeClassBoundEnd();
......
......@@ -252,6 +252,23 @@ public class JavaDescriptorResolver {
throw new IllegalStateException("PsiTypeParameter '" + name + "' is not found");
}
// cache
protected ClassDescriptor javaLangObject;
@NotNull
private ClassDescriptor getJavaLangObject() {
if (javaLangObject == null) {
javaLangObject = resolveClass("java.lang.Object");
}
return javaLangObject;
}
private boolean isJavaLangObject(JetType type) {
return type.getConstructor().getDeclarationDescriptor() == getJavaLangObject();
}
private abstract class JetSignatureTypeParameterVisitor extends JetSignatureExceptionsAdapter {
private final DeclarationDescriptor containingDeclaration;
......@@ -272,12 +289,15 @@ public class JavaDescriptorResolver {
List<JetType> upperBounds = new ArrayList<JetType>();
List<JetType> lowerBounds = new ArrayList<JetType>();
@Override
public JetSignatureVisitor visitClassBound() {
return new JetTypeJetSignatureReader(JavaDescriptorResolver.this, semanticServices.getJetSemanticServices().getStandardLibrary()) {
@Override
protected void done(@NotNull JetType jetType) {
if (isJavaLangObject(jetType)) {
return;
}
upperBounds.add(jetType);
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册