Minor. Better name for CollectionClassMapping class.
This commit is contained in:
+5
-5
@@ -20,13 +20,13 @@ import com.google.common.collect.ImmutableBiMap;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||||
|
|
||||||
public class MutableReadOnlyCollectionsMap extends JavaToKotlinClassMapBuilder {
|
public class CollectionClassMapping extends JavaToKotlinClassMapBuilder {
|
||||||
private static MutableReadOnlyCollectionsMap instance = null;
|
private static CollectionClassMapping instance = null;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static MutableReadOnlyCollectionsMap getInstance() {
|
public static CollectionClassMapping getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new MutableReadOnlyCollectionsMap();
|
instance = new CollectionClassMapping();
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ public class MutableReadOnlyCollectionsMap extends JavaToKotlinClassMapBuilder {
|
|||||||
private ImmutableBiMap.Builder<ClassDescriptor, ClassDescriptor> mapBuilder = ImmutableBiMap.builder();
|
private ImmutableBiMap.Builder<ClassDescriptor, ClassDescriptor> mapBuilder = ImmutableBiMap.builder();
|
||||||
private final ImmutableBiMap<ClassDescriptor, ClassDescriptor> mutableToReadOnlyMap;
|
private final ImmutableBiMap<ClassDescriptor, ClassDescriptor> mutableToReadOnlyMap;
|
||||||
|
|
||||||
private MutableReadOnlyCollectionsMap() {
|
private CollectionClassMapping() {
|
||||||
init();
|
init();
|
||||||
mutableToReadOnlyMap = mapBuilder.build();
|
mutableToReadOnlyMap = mapBuilder.build();
|
||||||
mapBuilder = null;
|
mapBuilder = null;
|
||||||
+6
-6
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||||
import org.jetbrains.jet.lang.resolve.java.MutableReadOnlyCollectionsMap;
|
import org.jetbrains.jet.lang.resolve.java.CollectionClassMapping;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JavaToKotlinClassMap;
|
import org.jetbrains.jet.lang.resolve.java.JavaToKotlinClassMap;
|
||||||
import org.jetbrains.jet.lang.resolve.java.wrapper.PsiMethodWrapper;
|
import org.jetbrains.jet.lang.resolve.java.wrapper.PsiMethodWrapper;
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||||
@@ -235,9 +235,9 @@ public class SignaturesPropagation {
|
|||||||
}
|
}
|
||||||
ClassDescriptor clazz = (ClassDescriptor) classifier;
|
ClassDescriptor clazz = (ClassDescriptor) classifier;
|
||||||
|
|
||||||
MutableReadOnlyCollectionsMap collectionsMap = MutableReadOnlyCollectionsMap.getInstance();
|
CollectionClassMapping collectionMapping = CollectionClassMapping.getInstance();
|
||||||
|
|
||||||
if (collectionsMap.isMutableCollection(clazz)) {
|
if (collectionMapping.isMutableCollection(clazz)) {
|
||||||
|
|
||||||
boolean someSupersMutable = false;
|
boolean someSupersMutable = false;
|
||||||
boolean someSupersReadOnly = false;
|
boolean someSupersReadOnly = false;
|
||||||
@@ -246,17 +246,17 @@ public class SignaturesPropagation {
|
|||||||
if (classifierFromSuper instanceof ClassDescriptor) {
|
if (classifierFromSuper instanceof ClassDescriptor) {
|
||||||
ClassDescriptor classFromSuper = (ClassDescriptor) classifierFromSuper;
|
ClassDescriptor classFromSuper = (ClassDescriptor) classifierFromSuper;
|
||||||
|
|
||||||
if (collectionsMap.isMutableCollection(classFromSuper)) {
|
if (collectionMapping.isMutableCollection(classFromSuper)) {
|
||||||
someSupersMutable = true;
|
someSupersMutable = true;
|
||||||
}
|
}
|
||||||
else if (collectionsMap.isReadOnlyCollection(classFromSuper)) {
|
else if (collectionMapping.isReadOnlyCollection(classFromSuper)) {
|
||||||
someSupersReadOnly = true;
|
someSupersReadOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (someSupersReadOnly && !someSupersMutable) {
|
if (someSupersReadOnly && !someSupersMutable) {
|
||||||
return collectionsMap.convertMutableToReadOnly(clazz);
|
return collectionMapping.convertMutableToReadOnly(clazz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return classifier;
|
return classifier;
|
||||||
|
|||||||
Reference in New Issue
Block a user