more FqName instead of String
This commit is contained in:
@@ -865,9 +865,9 @@ public class JetTypeMapper {
|
|||||||
|
|
||||||
private boolean isForceReal(JvmClassName className) {
|
private boolean isForceReal(JvmClassName className) {
|
||||||
return JvmPrimitiveType.getByWrapperClass(className) != null
|
return JvmPrimitiveType.getByWrapperClass(className) != null
|
||||||
|| className.getFqName().equals("java.lang.String")
|
|| className.getFqName().getFqName().equals("java.lang.String")
|
||||||
|| className.getFqName().equals("java.lang.CharSequence")
|
|| className.getFqName().getFqName().equals("java.lang.CharSequence")
|
||||||
|| className.getFqName().equals("java.lang.Object");
|
|| className.getFqName().getFqName().equals("java.lang.Object");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGenericsArray(JetType type) {
|
public boolean isGenericsArray(JetType type) {
|
||||||
|
|||||||
+5
-5
@@ -763,7 +763,7 @@ public class JavaDescriptorResolver {
|
|||||||
private void transformSupertypeList(List<JetType> result, PsiClassType[] extendsListTypes, TypeVariableResolver typeVariableResolver, boolean annotation) {
|
private void transformSupertypeList(List<JetType> result, PsiClassType[] extendsListTypes, TypeVariableResolver typeVariableResolver, boolean annotation) {
|
||||||
for (PsiClassType type : extendsListTypes) {
|
for (PsiClassType type : extendsListTypes) {
|
||||||
PsiClass resolved = type.resolve();
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
if (annotation && resolved.getQualifiedName().equals("java.lang.annotation.Annotation")) {
|
if (annotation && resolved.getQualifiedName().equals("java.lang.annotation.Annotation")) {
|
||||||
@@ -961,7 +961,7 @@ public class JavaDescriptorResolver {
|
|||||||
JetType transformedType;
|
JetType transformedType;
|
||||||
if (parameter.getJetValueParameter().nullable()) {
|
if (parameter.getJetValueParameter().nullable()) {
|
||||||
transformedType = TypeUtils.makeNullableAsSpecified(outType, 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);
|
transformedType = TypeUtils.makeNullableAsSpecified(outType, false);
|
||||||
} else {
|
} else {
|
||||||
transformedType = outType;
|
transformedType = outType;
|
||||||
@@ -1208,7 +1208,7 @@ public class JavaDescriptorResolver {
|
|||||||
propertyType = semanticServices.getTypeTransformer().transformToType(anyMember.getType().getTypeString(), typeVariableResolverForPropertyInternals);
|
propertyType = semanticServices.getTypeTransformer().transformToType(anyMember.getType().getTypeString(), typeVariableResolverForPropertyInternals);
|
||||||
} else {
|
} else {
|
||||||
propertyType = semanticServices.getTypeTransformer().transformToType(anyMember.getType().getPsiType(), typeVariableResolverForPropertyInternals);
|
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);
|
propertyType = TypeUtils.makeNullableAsSpecified(propertyType, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1507,7 +1507,7 @@ public class JavaDescriptorResolver {
|
|||||||
AnnotationDescriptor annotation = new AnnotationDescriptor();
|
AnnotationDescriptor annotation = new AnnotationDescriptor();
|
||||||
|
|
||||||
String qname = psiAnnotation.getQualifiedName();
|
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
|
// TODO
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1634,7 +1634,7 @@ public class JavaDescriptorResolver {
|
|||||||
}
|
}
|
||||||
if (method.getJetMethod().returnTypeNullable()) {
|
if (method.getJetMethod().returnTypeNullable()) {
|
||||||
return TypeUtils.makeNullableAsSpecified(transformedType, true);
|
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);
|
return TypeUtils.makeNullableAsSpecified(transformedType, false);
|
||||||
} else {
|
} else {
|
||||||
return transformedType;
|
return transformedType;
|
||||||
|
|||||||
+8
-9
@@ -57,7 +57,7 @@ public class JavaTypeTransformer {
|
|||||||
|
|
||||||
private Map<String, JetType> primitiveTypesMap;
|
private Map<String, JetType> primitiveTypesMap;
|
||||||
private Map<String, JetType> classTypesMap;
|
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();
|
PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
|
||||||
primitiveTypesMap.put(jvmPrimitiveType.getName(), JetStandardLibrary.getInstance().getPrimitiveJetType(primitiveType));
|
primitiveTypesMap.put(jvmPrimitiveType.getName(), JetStandardLibrary.getInstance().getPrimitiveJetType(primitiveType));
|
||||||
primitiveTypesMap.put("[" + jvmPrimitiveType.getName(), JetStandardLibrary.getInstance().getPrimitiveArrayJetType(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());
|
primitiveTypesMap.put("void", JetStandardClasses.getUnitType());
|
||||||
}
|
}
|
||||||
@@ -227,8 +227,7 @@ public class JavaTypeTransformer {
|
|||||||
classTypesMap = new HashMap<String, JetType>();
|
classTypesMap = new HashMap<String, JetType>();
|
||||||
for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
|
for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
|
||||||
PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
|
PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
|
||||||
classTypesMap.put(jvmPrimitiveType.getWrapper().getFqName(), JetStandardLibrary.getInstance().getNullablePrimitiveJetType(
|
classTypesMap.put(jvmPrimitiveType.getWrapper().getFqName().getFqName(), JetStandardLibrary.getInstance().getNullablePrimitiveJetType(primitiveType));
|
||||||
primitiveType));
|
|
||||||
}
|
}
|
||||||
classTypesMap.put("java.lang.Object", JetStandardClasses.getNullableAnyType());
|
classTypesMap.put("java.lang.Object", JetStandardClasses.getNullableAnyType());
|
||||||
classTypesMap.put("java.lang.String", JetStandardLibrary.getInstance().getNullableStringType());
|
classTypesMap.put("java.lang.String", JetStandardLibrary.getInstance().getNullableStringType());
|
||||||
@@ -238,16 +237,16 @@ public class JavaTypeTransformer {
|
|||||||
return classTypesMap;
|
return classTypesMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, ClassDescriptor> getPrimitiveWrappersClassDescriptorMap() {
|
public Map<FqName, ClassDescriptor> getPrimitiveWrappersClassDescriptorMap() {
|
||||||
if (classDescriptorMap == null) {
|
if (classDescriptorMap == null) {
|
||||||
classDescriptorMap = new HashMap<String, ClassDescriptor>();
|
classDescriptorMap = new HashMap<FqName, ClassDescriptor>();
|
||||||
for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
|
for (JvmPrimitiveType jvmPrimitiveType : JvmPrimitiveType.values()) {
|
||||||
PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
|
PrimitiveType primitiveType = jvmPrimitiveType.getPrimitiveType();
|
||||||
classDescriptorMap.put(jvmPrimitiveType.getWrapper().getFqName(), JetStandardLibrary.getInstance().getPrimitiveClassDescriptor(primitiveType));
|
classDescriptorMap.put(jvmPrimitiveType.getWrapper().getFqName(), JetStandardLibrary.getInstance().getPrimitiveClassDescriptor(primitiveType));
|
||||||
}
|
}
|
||||||
classDescriptorMap.put("java.lang.String", JetStandardLibrary.getInstance().getString());
|
classDescriptorMap.put(new FqName("java.lang.String"), JetStandardLibrary.getInstance().getString());
|
||||||
classDescriptorMap.put("java.lang.CharSequence", JetStandardLibrary.getInstance().getCharSequence());
|
classDescriptorMap.put(new FqName("java.lang.CharSequence"), JetStandardLibrary.getInstance().getCharSequence());
|
||||||
classDescriptorMap.put("java.lang.Throwable", JetStandardLibrary.getInstance().getThrowable());
|
classDescriptorMap.put(new FqName("java.lang.Throwable"), JetStandardLibrary.getInstance().getThrowable());
|
||||||
}
|
}
|
||||||
return classDescriptorMap;
|
return classDescriptorMap;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -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.getFqName());
|
this.classDescriptor = this.javaSemanticServices.getTypeTransformer().getPrimitiveWrappersClassDescriptorMap().get(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) {
|
||||||
|
|||||||
@@ -17,29 +17,38 @@
|
|||||||
package org.jetbrains.jet.lang.resolve.java;
|
package org.jetbrains.jet.lang.resolve.java;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.jet.lang.resolve.FqName;
|
||||||
import org.objectweb.asm.Type;
|
import org.objectweb.asm.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Stepan Koltsov
|
* @author Stepan Koltsov
|
||||||
*/
|
*/
|
||||||
public class JvmClassName {
|
public class JvmClassName {
|
||||||
|
|
||||||
private final String fqName;
|
@NotNull
|
||||||
|
private final FqName fqName;
|
||||||
|
|
||||||
public JvmClassName(@NotNull String fqName) {
|
public JvmClassName(@NotNull String fqName) {
|
||||||
|
this(new FqName(fqName));
|
||||||
|
}
|
||||||
|
|
||||||
|
public JvmClassName(@NotNull FqName fqName) {
|
||||||
this.fqName = fqName;
|
this.fqName = fqName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JvmClassName byInternalName(@NotNull String internalName) {
|
public static JvmClassName byInternalName(@NotNull String internalName) {
|
||||||
JvmClassName r = new JvmClassName(internalName.replace('/', '.'));
|
JvmClassName r = new JvmClassName(internalName.replace('/', '.'));
|
||||||
r.internalName = internalName;
|
r.internalName = internalName;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFqName() {
|
@NotNull
|
||||||
|
public FqName getFqName() {
|
||||||
return fqName;
|
return fqName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String internalName;
|
private String internalName;
|
||||||
|
|
||||||
public String getInternalName() {
|
public String getInternalName() {
|
||||||
@@ -54,9 +63,9 @@ public class JvmClassName {
|
|||||||
|
|
||||||
public String getDescriptor() {
|
public String getDescriptor() {
|
||||||
if (descriptor == null) {
|
if (descriptor == null) {
|
||||||
StringBuilder sb = new StringBuilder(fqName.length() + 2);
|
StringBuilder sb = new StringBuilder(fqName.getFqName().length() + 2);
|
||||||
sb.append('L');
|
sb.append('L');
|
||||||
sb.append(fqName.replace('.', '/'));
|
sb.append(fqName.getFqName().replace('.', '/'));
|
||||||
sb.append(';');
|
sb.append(';');
|
||||||
descriptor = sb.toString();
|
descriptor = sb.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -41,6 +41,6 @@ public class JetClassAnnotation extends PsiAnnotationWrapper {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JetClassAnnotation get(PsiClass psiClass) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -42,6 +42,6 @@ public class JetConstructorAnnotation extends PsiAnnotationWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static JetConstructorAnnotation get(PsiMethod constructor) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -80,6 +80,6 @@ public class JetMethodAnnotation extends PsiAnnotationWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static JetMethodAnnotation get(PsiMethod psiMethod) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -33,6 +33,6 @@ public class JetTypeParameterAnnotation extends PsiAnnotationWrapper {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JetTypeParameterAnnotation get(@NotNull PsiParameter psiParameter) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -80,7 +80,7 @@ public class JetValueParameterAnnotation extends PsiAnnotationWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static JetValueParameterAnnotation get(PsiParameter psiParameter) {
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user