CrackMe.apk
Download file
package kotlin.reflect.jvm.internal.impl.descriptors;
import kotlin.jvm.internal.Intrinsics;
import kotlin.reflect.jvm.internal.impl.incremental.components.LookupLocation;
import kotlin.reflect.jvm.internal.impl.name.FqName;
import kotlin.reflect.jvm.internal.impl.name.Name;
import kotlin.reflect.jvm.internal.impl.resolve.scopes.MemberScope;
/* compiled from: descriptorUtil.kt */
public final class DescriptorUtilKt {
public static final ClassDescriptor resolveClassByFqName(ModuleDescriptor moduleDescriptor, FqName fqName, LookupLocation lookupLocation) {
ClassifierDescriptor classifierDescriptor;
Intrinsics.checkNotNullParameter(moduleDescriptor, "<this>");
Intrinsics.checkNotNullParameter(fqName, "fqName");
Intrinsics.checkNotNullParameter(lookupLocation, "lookupLocation");
if (fqName.isRoot()) {
return null;
}
FqName parent = fqName.parent();
Intrinsics.checkNotNullExpressionValue(parent, "fqName.parent()");
MemberScope memberScope = moduleDescriptor.getPackage(parent).getMemberScope();
Name shortName = fqName.shortName();
Intrinsics.checkNotNullExpressionValue(shortName, "fqName.shortName()");
ClassifierDescriptor contributedClassifier = memberScope.getContributedClassifier(shortName, lookupLocation);
ClassDescriptor classDescriptor = contributedClassifier instanceof ClassDescriptor ? (ClassDescriptor) contributedClassifier : null;
if (classDescriptor != null) {
return classDescriptor;
}
FqName parent2 = fqName.parent();
Intrinsics.checkNotNullExpressionValue(parent2, "fqName.parent()");
ClassDescriptor resolveClassByFqName = resolveClassByFqName(moduleDescriptor, parent2, lookupLocation);
if (resolveClassByFqName == null) {
classifierDescriptor = null;
} else {
MemberScope unsubstitutedInnerClassesScope = resolveClassByFqName.getUnsubstitutedInnerClassesScope();
Name shortName2 = fqName.shortName();
Intrinsics.checkNotNullExpressionValue(shortName2, "fqName.shortName()");
classifierDescriptor = unsubstitutedInnerClassesScope.getContributedClassifier(shortName2, lookupLocation);
}
if (classifierDescriptor instanceof ClassDescriptor) {
return (ClassDescriptor) classifierDescriptor;
}
return null;
}
public static final boolean isTopLevelInPackage(DeclarationDescriptor declarationDescriptor) {
Intrinsics.checkNotNullParameter(declarationDescriptor, "<this>");
return declarationDescriptor.getContainingDeclaration() instanceof PackageFragmentDescriptor;
}
public static final ClassifierDescriptor getTopLevelContainingClassifier(DeclarationDescriptor declarationDescriptor) {
Intrinsics.checkNotNullParameter(declarationDescriptor, "<this>");
DeclarationDescriptor containingDeclaration = declarationDescriptor.getContainingDeclaration();
if (containingDeclaration == null || (declarationDescriptor instanceof PackageFragmentDescriptor)) {
return null;
}
if (!isTopLevelInPackage(containingDeclaration)) {
return getTopLevelContainingClassifier(containingDeclaration);
}
if (containingDeclaration instanceof ClassifierDescriptor) {
return (ClassifierDescriptor) containingDeclaration;
}
return null;
}
}
Download file