Type enhancement and qualifier extraction
This commit is contained in:
committed by
Denis Zharkov
parent
e095162c19
commit
991f0fcf2e
+12
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user