Nullable string type cached

This commit is contained in:
Andrey Breslav
2011-03-24 17:55:57 +03:00
parent 0262423d00
commit 120a03ccdc
@@ -28,7 +28,6 @@ public class JetStandardLibrary {
// TODO : consider releasing this memory // TODO : consider releasing this memory
private static final Map<Project, JetStandardLibrary> standardLibraryCache = new HashMap<Project, JetStandardLibrary>(); private static final Map<Project, JetStandardLibrary> standardLibraryCache = new HashMap<Project, JetStandardLibrary>();
public static JetStandardLibrary getJetStandardLibrary(@NotNull Project project) { public static JetStandardLibrary getJetStandardLibrary(@NotNull Project project) {
JetStandardLibrary standardLibrary = standardLibraryCache.get(project); JetStandardLibrary standardLibrary = standardLibraryCache.get(project);
if (standardLibrary == null) { if (standardLibrary == null) {
@@ -39,6 +38,7 @@ public class JetStandardLibrary {
} }
private final JetScope libraryScope; private final JetScope libraryScope;
private final ClassDescriptor byteClass; private final ClassDescriptor byteClass;
private final ClassDescriptor charClass; private final ClassDescriptor charClass;
private final ClassDescriptor shortClass; private final ClassDescriptor shortClass;
@@ -50,8 +50,8 @@ public class JetStandardLibrary {
private final ClassDescriptor stringClass; private final ClassDescriptor stringClass;
private final ClassDescriptor arrayClass; private final ClassDescriptor arrayClass;
private final ClassDescriptor iterableClass; private final ClassDescriptor iterableClass;
private final JetType byteType; private final JetType byteType;
private final JetType charType; private final JetType charType;
private final JetType shortType; private final JetType shortType;
private final JetType intType; private final JetType intType;
@@ -60,6 +60,7 @@ public class JetStandardLibrary {
private final JetType doubleType; private final JetType doubleType;
private final JetType booleanType; private final JetType booleanType;
private final JetType stringType; private final JetType stringType;
private final JetType nullableStringType;
private JetStandardLibrary(@NotNull Project project) { private JetStandardLibrary(@NotNull Project project) {
// TODO : review // TODO : review
@@ -98,6 +99,7 @@ public class JetStandardLibrary {
this.doubleType = new JetTypeImpl(getDouble()); this.doubleType = new JetTypeImpl(getDouble());
this.booleanType = new JetTypeImpl(getBoolean()); this.booleanType = new JetTypeImpl(getBoolean());
this.stringType = new JetTypeImpl(getString()); this.stringType = new JetTypeImpl(getString());
this.nullableStringType = TypeUtils.makeNullable(stringType);
} catch (IOException e) { } catch (IOException e) {
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
@@ -236,4 +238,8 @@ public class JetStandardLibrary {
getIterable().getMemberScope(types) getIterable().getMemberScope(types)
); );
} }
public JetType getNullableStringType() {
return nullableStringType;
}
} }