Minor, change method parameter from String to JvmClassName
This commit is contained in:
+2
-2
@@ -263,10 +263,10 @@ public class JavaTypeTransformer {
|
|||||||
if (!signatureTypeUsages.contains(originalTypeUsage)) {
|
if (!signatureTypeUsages.contains(originalTypeUsage)) {
|
||||||
return originalTypeUsage;
|
return originalTypeUsage;
|
||||||
}
|
}
|
||||||
if (JavaAnnotationResolver.findAnnotationWithExternal(owner, JvmAnnotationNames.JETBRAINS_MUTABLE_ANNOTATION.getFqName().asString()) != null) {
|
if (JavaAnnotationResolver.findAnnotationWithExternal(owner, JvmAnnotationNames.JETBRAINS_MUTABLE_ANNOTATION) != null) {
|
||||||
return TypeUsage.MEMBER_SIGNATURE_COVARIANT;
|
return TypeUsage.MEMBER_SIGNATURE_COVARIANT;
|
||||||
}
|
}
|
||||||
if (JavaAnnotationResolver.findAnnotationWithExternal(owner, JvmAnnotationNames.JETBRAINS_READONLY_ANNOTATION.getFqName().asString()) != null) {
|
if (JavaAnnotationResolver.findAnnotationWithExternal(owner, JvmAnnotationNames.JETBRAINS_READONLY_ANNOTATION) != null) {
|
||||||
return TypeUsage.MEMBER_SIGNATURE_CONTRAVARIANT;
|
return TypeUsage.MEMBER_SIGNATURE_CONTRAVARIANT;
|
||||||
}
|
}
|
||||||
return originalTypeUsage;
|
return originalTypeUsage;
|
||||||
|
|||||||
+1
-2
@@ -43,8 +43,7 @@ public class KotlinSignatureAnnotation {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static KotlinSignatureAnnotation get(@NotNull PsiMember member) {
|
public static KotlinSignatureAnnotation get(@NotNull PsiMember member) {
|
||||||
PsiAnnotation annotation = JavaAnnotationResolver.
|
PsiAnnotation annotation = JavaAnnotationResolver.findAnnotationWithExternal(member, JvmAnnotationNames.KOTLIN_SIGNATURE);
|
||||||
findAnnotationWithExternal(member, JvmAnnotationNames.KOTLIN_SIGNATURE.getFqName().asString());
|
|
||||||
return annotation != null ? new KotlinSignatureAnnotation(annotation) : NULL_ANNOTATION;
|
return annotation != null ? new KotlinSignatureAnnotation(annotation) : NULL_ANNOTATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -27,6 +27,7 @@ import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
|||||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||||
import org.jetbrains.jet.lang.resolve.java.DescriptorResolverUtils;
|
import org.jetbrains.jet.lang.resolve.java.DescriptorResolverUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JvmAnnotationNames;
|
import org.jetbrains.jet.lang.resolve.java.JvmAnnotationNames;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||||
import org.jetbrains.jet.lang.resolve.java.mapping.JavaToKotlinClassMap;
|
import org.jetbrains.jet.lang.resolve.java.mapping.JavaToKotlinClassMap;
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
@@ -153,10 +154,10 @@ public final class JavaAnnotationResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static PsiAnnotation findOwnAnnotation(@NotNull PsiModifierListOwner owner, @NotNull String fqName) {
|
public static PsiAnnotation findOwnAnnotation(@NotNull PsiModifierListOwner owner, @NotNull JvmClassName name) {
|
||||||
PsiModifierList list = owner.getModifierList();
|
PsiModifierList list = owner.getModifierList();
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
PsiAnnotation found = list.findAnnotation(fqName);
|
PsiAnnotation found = list.findAnnotation(name.getFqName().asString());
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
@@ -166,12 +167,12 @@ public final class JavaAnnotationResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static PsiAnnotation findAnnotationWithExternal(@NotNull PsiModifierListOwner owner, @NotNull String fqName) {
|
public static PsiAnnotation findAnnotationWithExternal(@NotNull PsiModifierListOwner owner, @NotNull JvmClassName name) {
|
||||||
PsiAnnotation annotation = findOwnAnnotation(owner, fqName);
|
PsiAnnotation annotation = findOwnAnnotation(owner, name);
|
||||||
if (annotation != null) {
|
if (annotation != null) {
|
||||||
return annotation;
|
return annotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ExternalAnnotationsManager.getInstance(owner.getProject()).findExternalAnnotation(owner, fqName);
|
return ExternalAnnotationsManager.getInstance(owner.getProject()).findExternalAnnotation(owner, name.getFqName().asString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-4
@@ -376,10 +376,7 @@ public final class JavaFunctionResolver {
|
|||||||
.adjustTypeUsageWithMutabilityAnnotations(method.getPsiMethod(), TypeUsage.MEMBER_SIGNATURE_COVARIANT);
|
.adjustTypeUsageWithMutabilityAnnotations(method.getPsiMethod(), TypeUsage.MEMBER_SIGNATURE_COVARIANT);
|
||||||
JetType transformedType = typeTransformer.transformToType(returnType, typeUsage, typeVariableResolver);
|
JetType transformedType = typeTransformer.transformToType(returnType, typeUsage, typeVariableResolver);
|
||||||
|
|
||||||
if (JavaAnnotationResolver
|
if (JavaAnnotationResolver.findAnnotationWithExternal(method.getPsiMethod(), JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION) != null) {
|
||||||
.findAnnotationWithExternal(method.getPsiMethod(),
|
|
||||||
JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().asString()) !=
|
|
||||||
null) {
|
|
||||||
return TypeUtils.makeNullableAsSpecified(transformedType, false);
|
return TypeUtils.makeNullableAsSpecified(transformedType, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+2
-1
@@ -233,7 +233,8 @@ public final class JavaPropertyResolver {
|
|||||||
|
|
||||||
boolean hasNotNullAnnotation = JavaAnnotationResolver.findAnnotationWithExternal(
|
boolean hasNotNullAnnotation = JavaAnnotationResolver.findAnnotationWithExternal(
|
||||||
field.getPsiField(),
|
field.getPsiField(),
|
||||||
JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().asString()) != null;
|
JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION
|
||||||
|
) != null;
|
||||||
|
|
||||||
if (hasNotNullAnnotation || isStaticFinalField(field)) {
|
if (hasNotNullAnnotation || isStaticFinalField(field)) {
|
||||||
propertyType = TypeUtils.makeNotNullable(propertyType);
|
propertyType = TypeUtils.makeNotNullable(propertyType);
|
||||||
|
|||||||
+2
-4
@@ -36,8 +36,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationResolver.findAnnotationWithExternal;
|
|
||||||
|
|
||||||
public final class JavaValueParameterResolver {
|
public final class JavaValueParameterResolver {
|
||||||
|
|
||||||
private JavaTypeTransformer typeTransformer;
|
private JavaTypeTransformer typeTransformer;
|
||||||
@@ -70,8 +68,8 @@ public final class JavaValueParameterResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JetType transformedType;
|
JetType transformedType;
|
||||||
PsiAnnotation notNullAnnotation =
|
PsiAnnotation notNullAnnotation = JavaAnnotationResolver
|
||||||
findAnnotationWithExternal(parameter, JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().asString());
|
.findAnnotationWithExternal(parameter, JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION);
|
||||||
if (notNullAnnotation != null) {
|
if (notNullAnnotation != null) {
|
||||||
transformedType = TypeUtils.makeNullableAsSpecified(outType, false);
|
transformedType = TypeUtils.makeNullableAsSpecified(outType, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class KotlinSignatureUtil {
|
|||||||
static PsiAnnotation findKotlinSignatureAnnotation(@NotNull PsiElement element) {
|
static PsiAnnotation findKotlinSignatureAnnotation(@NotNull PsiElement element) {
|
||||||
if (!(element instanceof PsiModifierListOwner)) return null;
|
if (!(element instanceof PsiModifierListOwner)) return null;
|
||||||
PsiModifierListOwner annotationOwner = getAnnotationOwner(element);
|
PsiModifierListOwner annotationOwner = getAnnotationOwner(element);
|
||||||
PsiAnnotation annotation = JavaAnnotationResolver.findAnnotationWithExternal(annotationOwner, KOTLIN_SIGNATURE_ANNOTATION);
|
PsiAnnotation annotation = JavaAnnotationResolver.findAnnotationWithExternal(annotationOwner, JvmAnnotationNames.KOTLIN_SIGNATURE);
|
||||||
if (annotation == null) return null;
|
if (annotation == null) return null;
|
||||||
if (annotation.getParameterList().getAttributes().length == 0) return null;
|
if (annotation.getParameterList().getAttributes().length == 0) return null;
|
||||||
return annotation;
|
return annotation;
|
||||||
|
|||||||
Reference in New Issue
Block a user