returnTypeNullable in flags duplicates info in returnType annotation field
This commit is contained in:
@@ -356,8 +356,6 @@ public class FunctionCodegen extends GenerationStateAware {
|
|||||||
}
|
}
|
||||||
kotlinFlags |= DescriptorKindUtils.kindToFlags(functionDescriptor.getKind());
|
kotlinFlags |= DescriptorKindUtils.kindToFlags(functionDescriptor.getKind());
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
if (functionDescriptor.getReturnType().isNullable())
|
|
||||||
kotlinFlags |= JvmStdlibNames.FLAG_NULLABLE_RETURN_TYPE_BIT;
|
|
||||||
aw.writeFlags(kotlinFlags);
|
aw.writeFlags(kotlinFlags);
|
||||||
aw.writeTypeParameters(jvmSignature.getKotlinTypeParameter());
|
aw.writeTypeParameters(jvmSignature.getKotlinTypeParameter());
|
||||||
aw.writeReturnType(jvmSignature.getKotlinReturnType());
|
aw.writeReturnType(jvmSignature.getKotlinReturnType());
|
||||||
|
|||||||
@@ -1225,8 +1225,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
else {
|
else {
|
||||||
JetType returnType = fun.getReturnType();
|
JetType returnType = fun.getReturnType();
|
||||||
assert returnType != null;
|
assert returnType != null;
|
||||||
if (returnType.isNullable())
|
|
||||||
kotlinFlags |= JvmStdlibNames.FLAG_NULLABLE_RETURN_TYPE_BIT;
|
|
||||||
aw.writeTypeParameters(jvmSignature.getKotlinTypeParameter());
|
aw.writeTypeParameters(jvmSignature.getKotlinTypeParameter());
|
||||||
aw.writeReturnType(jvmSignature.getKotlinReturnType());
|
aw.writeReturnType(jvmSignature.getKotlinReturnType());
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -1879,10 +1879,8 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
|||||||
transformedType = semanticServices.getTypeTransformer().transformToType(
|
transformedType = semanticServices.getTypeTransformer().transformToType(
|
||||||
returnType, JavaTypeTransformer.TypeUsage.MEMBER_SIGNATURE_COVARIANT, typeVariableResolver);
|
returnType, JavaTypeTransformer.TypeUsage.MEMBER_SIGNATURE_COVARIANT, typeVariableResolver);
|
||||||
}
|
}
|
||||||
if (method.getJetMethod().returnTypeNullable()) {
|
|
||||||
return TypeUtils.makeNullableAsSpecified(transformedType, true);
|
if (findAnnotation(method.getPsiMethod(), JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().getFqName()) != null) {
|
||||||
}
|
|
||||||
else if (findAnnotation(method.getPsiMethod(), JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().getFqName()) != null) {
|
|
||||||
return TypeUtils.makeNullableAsSpecified(transformedType, false);
|
return TypeUtils.makeNullableAsSpecified(transformedType, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -52,14 +52,13 @@ public class JvmStdlibNames {
|
|||||||
public static final int FLAG_FORCE_FINAL_BIT = 1 << 2;
|
public static final int FLAG_FORCE_FINAL_BIT = 1 << 2;
|
||||||
public static final int FLAG_PRIVATE_BIT = 1 << 3;
|
public static final int FLAG_PRIVATE_BIT = 1 << 3;
|
||||||
public static final int FLAG_INTERNAL_BIT = 1 << 4;
|
public static final int FLAG_INTERNAL_BIT = 1 << 4;
|
||||||
public static final int FLAG_NULLABLE_RETURN_TYPE_BIT = 1 << 5;
|
|
||||||
|
|
||||||
// three bits (one reserved)
|
// three bits (one reserved)
|
||||||
public static final int FLAG_KIND_MASK = 7 << 6;
|
public static final int FLAG_KIND_MASK = 7 << 5;
|
||||||
public static final int FLAG_KIND_DECLARATION = 0 << 6;
|
public static final int FLAG_KIND_DECLARATION = 0 << 5;
|
||||||
public static final int FLAG_KIND_FAKE_OVERRIDE = 1 << 6;
|
public static final int FLAG_KIND_FAKE_OVERRIDE = 1 << 5;
|
||||||
public static final int FLAG_KIND_DELEGATION = 2 << 6;
|
public static final int FLAG_KIND_DELEGATION = 2 << 5;
|
||||||
public static final int FLAG_KIND_SYNTHESIZED = 3 << 6;
|
public static final int FLAG_KIND_SYNTHESIZED = 3 << 5;
|
||||||
|
|
||||||
public static final JvmClassName JET_CONSTRUCTOR = JvmClassName.byFqNameWithoutInnerClasses("jet.runtime.typeinfo.JetConstructor");
|
public static final JvmClassName JET_CONSTRUCTOR = JvmClassName.byFqNameWithoutInnerClasses("jet.runtime.typeinfo.JetConstructor");
|
||||||
|
|
||||||
|
|||||||
+15
-13
@@ -79,19 +79,21 @@ public class PsiClassFinderImpl implements PsiClassFinder {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
PsiAnnotation assertInvisibleAnnotation = JavaDescriptorResolver
|
if ("jet".equals(qualifiedName.parent().getFqName())) {
|
||||||
.findAnnotation(original, JvmStdlibNames.ASSERT_INVISIBLE_IN_RESOLVER.getFqName().getFqName());
|
PsiAnnotation assertInvisibleAnnotation = JavaDescriptorResolver
|
||||||
if (assertInvisibleAnnotation != null) {
|
.findAnnotation(original, JvmStdlibNames.ASSERT_INVISIBLE_IN_RESOLVER.getFqName().getFqName());
|
||||||
if (runtimeClassesHandleMode == RuntimeClassesHandleMode.IGNORE) {
|
if (assertInvisibleAnnotation != null) {
|
||||||
return null;
|
if (runtimeClassesHandleMode == RuntimeClassesHandleMode.IGNORE) {
|
||||||
}
|
return null;
|
||||||
else if (runtimeClassesHandleMode == RuntimeClassesHandleMode.THROW) {
|
}
|
||||||
throw new IllegalStateException(
|
else if (runtimeClassesHandleMode == RuntimeClassesHandleMode.THROW) {
|
||||||
"classpath is configured incorrectly:" +
|
throw new IllegalStateException(
|
||||||
" class " + qualifiedName + " from runtime must not be loaded by compiler");
|
"classpath is configured incorrectly:" +
|
||||||
}
|
" class " + qualifiedName + " from runtime must not be loaded by compiler");
|
||||||
else {
|
}
|
||||||
throw new IllegalStateException("unknown parameter value: " + runtimeClassesHandleMode);
|
else {
|
||||||
|
throw new IllegalStateException("unknown parameter value: " + runtimeClassesHandleMode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-4
@@ -61,10 +61,6 @@ public class JetMethodAnnotation extends PsiAnnotationWithFlags {
|
|||||||
return returnType;
|
return returnType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean returnTypeNullable() {
|
|
||||||
return (flags() & JvmStdlibNames.FLAG_NULLABLE_RETURN_TYPE_BIT) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public String propertyType() {
|
public String propertyType() {
|
||||||
checkInitialized();
|
checkInitialized();
|
||||||
|
|||||||
Reference in New Issue
Block a user