do not expose map

This commit is contained in:
Stepan Koltsov
2012-04-07 06:32:19 +04:00
parent 8623361e22
commit 498d444a0a
2 changed files with 8 additions and 2 deletions
@@ -19,6 +19,7 @@ package org.jetbrains.jet.lang.resolve.java;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.intellij.psi.*; import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor; import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
@@ -237,7 +238,7 @@ public class JavaTypeTransformer {
return classTypesMap; return classTypesMap;
} }
public Map<FqName, ClassDescriptor> getPrimitiveWrappersClassDescriptorMap() { private Map<FqName, ClassDescriptor> getPrimitiveWrappersClassDescriptorMap() {
if (classDescriptorMap == null) { if (classDescriptorMap == null) {
classDescriptorMap = new HashMap<FqName, ClassDescriptor>(); classDescriptorMap = new HashMap<FqName, ClassDescriptor>();
for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) { for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
@@ -251,6 +252,11 @@ public class JavaTypeTransformer {
return classDescriptorMap; return classDescriptorMap;
} }
@Nullable
public ClassDescriptor unwrapPrimitive(@NotNull FqName fqName) {
return getPrimitiveWrappersClassDescriptorMap().get(fqName);
}
/** /**
* We convert Java types differently, depending on where they occur in the Java code * We convert Java types differently, depending on where they occur in the Java code
* This enum encodes the kinds of occurrences * This enum encodes the kinds of occurrences
@@ -93,7 +93,7 @@ public abstract class JetTypeJetSignatureReader extends JetSignatureExceptionsAd
this.classDescriptor = null; this.classDescriptor = null;
if (this.classDescriptor == null && !forceReal) { if (this.classDescriptor == null && !forceReal) {
this.classDescriptor = this.javaSemanticServices.getTypeTransformer().getPrimitiveWrappersClassDescriptorMap().get(ourName); this.classDescriptor = this.javaSemanticServices.getTypeTransformer().unwrapPrimitive(ourName);
} }
if (this.classDescriptor == null && ourName.equals(new FqName("java.lang.Object")) && !forceReal) { if (this.classDescriptor == null && ourName.equals(new FqName("java.lang.Object")) && !forceReal) {