more FqName instead of String

This commit is contained in:
Stepan Koltsov
2012-04-07 06:32:19 +04:00
parent 9e9d60e02a
commit 8623361e22
10 changed files with 38 additions and 30 deletions
@@ -763,7 +763,7 @@ public class JavaDescriptorResolver {
private void transformSupertypeList(List<JetType> result, PsiClassType[] extendsListTypes, TypeVariableResolver typeVariableResolver, boolean annotation) {
for (PsiClassType type : extendsListTypes) {
PsiClass resolved = type.resolve();
if (resolved != null && resolved.getQualifiedName().equals(JvmStdlibNames.JET_OBJECT.getFqName())) {
if (resolved != null && resolved.getQualifiedName().equals(JvmStdlibNames.JET_OBJECT.getFqName().getFqName())) {
continue;
}
if (annotation && resolved.getQualifiedName().equals("java.lang.annotation.Annotation")) {
@@ -961,7 +961,7 @@ public class JavaDescriptorResolver {
JetType transformedType;
if (parameter.getJetValueParameter().nullable()) {
transformedType = TypeUtils.makeNullableAsSpecified(outType, parameter.getJetValueParameter().nullable());
} else if (parameter.getPsiParameter().getModifierList().findAnnotation(JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName()) != null) {
} else if (parameter.getPsiParameter().getModifierList().findAnnotation(JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().getFqName()) != null) {
transformedType = TypeUtils.makeNullableAsSpecified(outType, false);
} else {
transformedType = outType;
@@ -1208,7 +1208,7 @@ public class JavaDescriptorResolver {
propertyType = semanticServices.getTypeTransformer().transformToType(anyMember.getType().getTypeString(), typeVariableResolverForPropertyInternals);
} else {
propertyType = semanticServices.getTypeTransformer().transformToType(anyMember.getType().getPsiType(), typeVariableResolverForPropertyInternals);
if (anyMember.getType().getPsiNotNullOwner().getModifierList().findAnnotation(JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName()) != null) {
if (anyMember.getType().getPsiNotNullOwner().getModifierList().findAnnotation(JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().getFqName()) != null) {
propertyType = TypeUtils.makeNullableAsSpecified(propertyType, false);
}
}
@@ -1507,7 +1507,7 @@ public class JavaDescriptorResolver {
AnnotationDescriptor annotation = new AnnotationDescriptor();
String qname = psiAnnotation.getQualifiedName();
if (qname.startsWith("java.lang.annotation.") || qname.startsWith("jet.runtime.typeinfo.") || qname.equals(JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName())) {
if (qname.startsWith("java.lang.annotation.") || qname.startsWith("jet.runtime.typeinfo.") || qname.equals(JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().getFqName())) {
// TODO
return null;
}
@@ -1634,7 +1634,7 @@ public class JavaDescriptorResolver {
}
if (method.getJetMethod().returnTypeNullable()) {
return TypeUtils.makeNullableAsSpecified(transformedType, true);
} else if (method.getPsiMethod().getModifierList().findAnnotation(JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName()) != null) {
} else if (method.getPsiMethod().getModifierList().findAnnotation(JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().getFqName()) != null) {
return TypeUtils.makeNullableAsSpecified(transformedType, false);
} else {
return transformedType;
@@ -57,7 +57,7 @@ public class JavaTypeTransformer {
private Map<String, JetType> primitiveTypesMap;
private Map<String, JetType> classTypesMap;
private Map<String, ClassDescriptor> classDescriptorMap;
private HashMap<FqName, ClassDescriptor> classDescriptorMap;
@@ -215,7 +215,7 @@ public class JavaTypeTransformer {
PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
primitiveTypesMap.put(jvmPrimitiveType.getName(), JetStandardLibrary.getInstance().getPrimitiveJetType(primitiveType));
primitiveTypesMap.put("[" + jvmPrimitiveType.getName(), JetStandardLibrary.getInstance().getPrimitiveArrayJetType(primitiveType));
primitiveTypesMap.put(jvmPrimitiveType.getWrapper().getFqName(), JetStandardLibrary.getInstance().getNullablePrimitiveJetType(primitiveType));
primitiveTypesMap.put(jvmPrimitiveType.getWrapper().getFqName().getFqName(), JetStandardLibrary.getInstance().getNullablePrimitiveJetType(primitiveType));
}
primitiveTypesMap.put("void", JetStandardClasses.getUnitType());
}
@@ -227,8 +227,7 @@ public class JavaTypeTransformer {
classTypesMap = new HashMap<String, JetType>();
for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
classTypesMap.put(jvmPrimitiveType.getWrapper().getFqName(), JetStandardLibrary.getInstance().getNullablePrimitiveJetType(
primitiveType));
classTypesMap.put(jvmPrimitiveType.getWrapper().getFqName().getFqName(), JetStandardLibrary.getInstance().getNullablePrimitiveJetType(primitiveType));
}
classTypesMap.put("java.lang.Object", JetStandardClasses.getNullableAnyType());
classTypesMap.put("java.lang.String", JetStandardLibrary.getInstance().getNullableStringType());
@@ -238,16 +237,16 @@ public class JavaTypeTransformer {
return classTypesMap;
}
public Map<String, ClassDescriptor> getPrimitiveWrappersClassDescriptorMap() {
public Map<FqName, ClassDescriptor> getPrimitiveWrappersClassDescriptorMap() {
if (classDescriptorMap == null) {
classDescriptorMap = new HashMap<String, ClassDescriptor>();
classDescriptorMap = new HashMap<FqName, ClassDescriptor>();
for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
classDescriptorMap.put(jvmPrimitiveType.getWrapper().getFqName(), JetStandardLibrary.getInstance().getPrimitiveClassDescriptor(primitiveType));
}
classDescriptorMap.put("java.lang.String", JetStandardLibrary.getInstance().getString());
classDescriptorMap.put("java.lang.CharSequence", JetStandardLibrary.getInstance().getCharSequence());
classDescriptorMap.put("java.lang.Throwable", JetStandardLibrary.getInstance().getThrowable());
classDescriptorMap.put(new FqName("java.lang.String"), JetStandardLibrary.getInstance().getString());
classDescriptorMap.put(new FqName("java.lang.CharSequence"), JetStandardLibrary.getInstance().getCharSequence());
classDescriptorMap.put(new FqName("java.lang.Throwable"), JetStandardLibrary.getInstance().getThrowable());
}
return classDescriptorMap;
}
@@ -93,7 +93,7 @@ public abstract class JetTypeJetSignatureReader extends JetSignatureExceptionsAd
this.classDescriptor = null;
if (this.classDescriptor == null && !forceReal) {
this.classDescriptor = this.javaSemanticServices.getTypeTransformer().getPrimitiveWrappersClassDescriptorMap().get(ourName.getFqName());
this.classDescriptor = this.javaSemanticServices.getTypeTransformer().getPrimitiveWrappersClassDescriptorMap().get(ourName);
}
if (this.classDescriptor == null && ourName.equals(new FqName("java.lang.Object")) && !forceReal) {
@@ -17,29 +17,38 @@
package org.jetbrains.jet.lang.resolve.java;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.resolve.FqName;
import org.objectweb.asm.Type;
/**
* @author Stepan Koltsov
*/
public class JvmClassName {
private final String fqName;
@NotNull
private final FqName fqName;
public JvmClassName(@NotNull String fqName) {
this(new FqName(fqName));
}
public JvmClassName(@NotNull FqName fqName) {
this.fqName = fqName;
}
public static JvmClassName byInternalName(@NotNull String internalName) {
JvmClassName r = new JvmClassName(internalName.replace('/', '.'));
r.internalName = internalName;
return r;
}
public String getFqName() {
@NotNull
public FqName getFqName() {
return fqName;
}
private String internalName;
public String getInternalName() {
@@ -54,9 +63,9 @@ public class JvmClassName {
public String getDescriptor() {
if (descriptor == null) {
StringBuilder sb = new StringBuilder(fqName.length() + 2);
StringBuilder sb = new StringBuilder(fqName.getFqName().length() + 2);
sb.append('L');
sb.append(fqName.replace('.', '/'));
sb.append(fqName.getFqName().replace('.', '/'));
sb.append(';');
descriptor = sb.toString();
}
@@ -41,6 +41,6 @@ public class JetClassAnnotation extends PsiAnnotationWrapper {
@NotNull
public static JetClassAnnotation get(PsiClass psiClass) {
return new JetClassAnnotation(psiClass.getModifierList().findAnnotation(JvmStdlibNames.JET_CLASS.getFqName()));
return new JetClassAnnotation(psiClass.getModifierList().findAnnotation(JvmStdlibNames.JET_CLASS.getFqName().getFqName()));
}
}
@@ -42,6 +42,6 @@ public class JetConstructorAnnotation extends PsiAnnotationWrapper {
}
public static JetConstructorAnnotation get(PsiMethod constructor) {
return new JetConstructorAnnotation(constructor.getModifierList().findAnnotation(JvmStdlibNames.JET_CONSTRUCTOR.getFqName()));
return new JetConstructorAnnotation(constructor.getModifierList().findAnnotation(JvmStdlibNames.JET_CONSTRUCTOR.getFqName().getFqName()));
}
}
@@ -80,6 +80,6 @@ public class JetMethodAnnotation extends PsiAnnotationWrapper {
}
public static JetMethodAnnotation get(PsiMethod psiMethod) {
return new JetMethodAnnotation(psiMethod.getModifierList().findAnnotation(JvmStdlibNames.JET_METHOD.getFqName()));
return new JetMethodAnnotation(psiMethod.getModifierList().findAnnotation(JvmStdlibNames.JET_METHOD.getFqName().getFqName()));
}
}
@@ -33,6 +33,6 @@ public class JetTypeParameterAnnotation extends PsiAnnotationWrapper {
@NotNull
public static JetTypeParameterAnnotation get(@NotNull PsiParameter psiParameter) {
return new JetTypeParameterAnnotation(psiParameter.getModifierList().findAnnotation(JvmStdlibNames.JET_TYPE_PARAMETER.getFqName()));
return new JetTypeParameterAnnotation(psiParameter.getModifierList().findAnnotation(JvmStdlibNames.JET_TYPE_PARAMETER.getFqName().getFqName()));
}
}
@@ -80,7 +80,7 @@ public class JetValueParameterAnnotation extends PsiAnnotationWrapper {
}
public static JetValueParameterAnnotation get(PsiParameter psiParameter) {
return new JetValueParameterAnnotation(psiParameter.getModifierList().findAnnotation(JvmStdlibNames.JET_VALUE_PARAMETER.getFqName()));
return new JetValueParameterAnnotation(psiParameter.getModifierList().findAnnotation(JvmStdlibNames.JET_VALUE_PARAMETER.getFqName().getFqName()));
}
}