Type enhancement and qualifier extraction

This commit is contained in:
Andrey Breslav
2015-04-15 18:25:13 +03:00
committed by Denis Zharkov
parent e095162c19
commit 991f0fcf2e
3 changed files with 203 additions and 0 deletions
@@ -29,6 +29,8 @@ import org.jetbrains.kotlin.name.FqNameUnsafe;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypeUtils;
import java.lang.annotation.Annotation;
import java.util.*;
@@ -186,10 +188,20 @@ public class JavaToKotlinClassMap implements PlatformToKotlinClassMap {
return mutableToReadOnly.containsKey(mutable);
}
public boolean isMutable(@NotNull JetType type) {
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(type);
return classDescriptor != null && isMutable(classDescriptor);
}
public boolean isReadOnly(@NotNull ClassDescriptor readOnly) {
return readOnlyToMutable.containsKey(readOnly);
}
public boolean isReadOnly(@NotNull JetType type) {
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(type);
return classDescriptor != null && isReadOnly(classDescriptor);
}
@NotNull
public ClassDescriptor convertMutableToReadOnly(@NotNull ClassDescriptor mutable) {
ClassDescriptor readOnly = mutableToReadOnly.get(mutable);