Detect Kotlin binaries by actually loading binary data, not simply checking whether the annotation is present

This is needed because even if the annotation is present, the ABI version may be wrong, and we should load such class as a Java class anyways
This commit is contained in:
Andrey Breslav
2013-11-13 15:22:17 +04:00
parent b16b9c58e1
commit ec1960a960
@@ -153,11 +153,19 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
@Nullable
@Override
public JavaClass findClass(@NotNull FqName fqName) {
// Do not look for JavaClasses for Kotlin binaries
if (kotlinClassesFromBinaries.invoke(fqName) != null
|| kotlinNamespacesFromBinaries.invoke(fqName) != null) {
return null;
}
JavaClass javaClass = javaClassFinder.findClass(fqName);
if (javaClass == null) {
return null;
}
if (DescriptorResolverUtils.isCompiledKotlinClassOrPackageClass(javaClass)) {
// Light classes are not proper binaries either
if (javaClass.getOriginKind() == JavaClass.OriginKind.KOTLIN_LIGHT_CLASS) {
return null;
}
return javaClass;