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)) {
|
||||
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;
|
||||
}
|
||||
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 originalTypeUsage;
|
||||
|
||||
+1
-2
@@ -43,8 +43,7 @@ public class KotlinSignatureAnnotation {
|
||||
|
||||
@NotNull
|
||||
public static KotlinSignatureAnnotation get(@NotNull PsiMember member) {
|
||||
PsiAnnotation annotation = JavaAnnotationResolver.
|
||||
findAnnotationWithExternal(member, JvmAnnotationNames.KOTLIN_SIGNATURE.getFqName().asString());
|
||||
PsiAnnotation annotation = JavaAnnotationResolver.findAnnotationWithExternal(member, JvmAnnotationNames.KOTLIN_SIGNATURE);
|
||||
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.java.DescriptorResolverUtils;
|
||||
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.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
@@ -153,10 +154,10 @@ public final class JavaAnnotationResolver {
|
||||
}
|
||||
|
||||
@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();
|
||||
if (list != null) {
|
||||
PsiAnnotation found = list.findAnnotation(fqName);
|
||||
PsiAnnotation found = list.findAnnotation(name.getFqName().asString());
|
||||
if (found != null) {
|
||||
return found;
|
||||
}
|
||||
@@ -166,12 +167,12 @@ public final class JavaAnnotationResolver {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiAnnotation findAnnotationWithExternal(@NotNull PsiModifierListOwner owner, @NotNull String fqName) {
|
||||
PsiAnnotation annotation = findOwnAnnotation(owner, fqName);
|
||||
public static PsiAnnotation findAnnotationWithExternal(@NotNull PsiModifierListOwner owner, @NotNull JvmClassName name) {
|
||||
PsiAnnotation annotation = findOwnAnnotation(owner, name);
|
||||
if (annotation != null) {
|
||||
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);
|
||||
JetType transformedType = typeTransformer.transformToType(returnType, typeUsage, typeVariableResolver);
|
||||
|
||||
if (JavaAnnotationResolver
|
||||
.findAnnotationWithExternal(method.getPsiMethod(),
|
||||
JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().asString()) !=
|
||||
null) {
|
||||
if (JavaAnnotationResolver.findAnnotationWithExternal(method.getPsiMethod(), JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION) != null) {
|
||||
return TypeUtils.makeNullableAsSpecified(transformedType, false);
|
||||
}
|
||||
else {
|
||||
|
||||
+2
-1
@@ -233,7 +233,8 @@ public final class JavaPropertyResolver {
|
||||
|
||||
boolean hasNotNullAnnotation = JavaAnnotationResolver.findAnnotationWithExternal(
|
||||
field.getPsiField(),
|
||||
JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().asString()) != null;
|
||||
JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION
|
||||
) != null;
|
||||
|
||||
if (hasNotNullAnnotation || isStaticFinalField(field)) {
|
||||
propertyType = TypeUtils.makeNotNullable(propertyType);
|
||||
|
||||
+2
-4
@@ -36,8 +36,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationResolver.findAnnotationWithExternal;
|
||||
|
||||
public final class JavaValueParameterResolver {
|
||||
|
||||
private JavaTypeTransformer typeTransformer;
|
||||
@@ -70,8 +68,8 @@ public final class JavaValueParameterResolver {
|
||||
}
|
||||
|
||||
JetType transformedType;
|
||||
PsiAnnotation notNullAnnotation =
|
||||
findAnnotationWithExternal(parameter, JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().asString());
|
||||
PsiAnnotation notNullAnnotation = JavaAnnotationResolver
|
||||
.findAnnotationWithExternal(parameter, JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION);
|
||||
if (notNullAnnotation != null) {
|
||||
transformedType = TypeUtils.makeNullableAsSpecified(outType, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user