returnTypeNullable in flags duplicates info in returnType annotation field

This commit is contained in:
Alex Tkachman
2012-09-23 12:22:57 +02:00
parent 1ec32810f4
commit edc0bf0b15
6 changed files with 22 additions and 31 deletions
@@ -1879,10 +1879,8 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
transformedType = semanticServices.getTypeTransformer().transformToType(
returnType, JavaTypeTransformer.TypeUsage.MEMBER_SIGNATURE_COVARIANT, typeVariableResolver);
}
if (method.getJetMethod().returnTypeNullable()) {
return TypeUtils.makeNullableAsSpecified(transformedType, true);
}
else if (findAnnotation(method.getPsiMethod(), JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().getFqName()) != null) {
if (findAnnotation(method.getPsiMethod(), JvmAbi.JETBRAINS_NOT_NULL_ANNOTATION.getFqName().getFqName()) != null) {
return TypeUtils.makeNullableAsSpecified(transformedType, false);
}
else {
@@ -52,14 +52,13 @@ public class JvmStdlibNames {
public static final int FLAG_FORCE_FINAL_BIT = 1 << 2;
public static final int FLAG_PRIVATE_BIT = 1 << 3;
public static final int FLAG_INTERNAL_BIT = 1 << 4;
public static final int FLAG_NULLABLE_RETURN_TYPE_BIT = 1 << 5;
// three bits (one reserved)
public static final int FLAG_KIND_MASK = 7 << 6;
public static final int FLAG_KIND_DECLARATION = 0 << 6;
public static final int FLAG_KIND_FAKE_OVERRIDE = 1 << 6;
public static final int FLAG_KIND_DELEGATION = 2 << 6;
public static final int FLAG_KIND_SYNTHESIZED = 3 << 6;
public static final int FLAG_KIND_MASK = 7 << 5;
public static final int FLAG_KIND_DECLARATION = 0 << 5;
public static final int FLAG_KIND_FAKE_OVERRIDE = 1 << 5;
public static final int FLAG_KIND_DELEGATION = 2 << 5;
public static final int FLAG_KIND_SYNTHESIZED = 3 << 5;
public static final JvmClassName JET_CONSTRUCTOR = JvmClassName.byFqNameWithoutInnerClasses("jet.runtime.typeinfo.JetConstructor");
@@ -79,19 +79,21 @@ public class PsiClassFinderImpl implements PsiClassFinder {
return null;
}
PsiAnnotation assertInvisibleAnnotation = JavaDescriptorResolver
.findAnnotation(original, JvmStdlibNames.ASSERT_INVISIBLE_IN_RESOLVER.getFqName().getFqName());
if (assertInvisibleAnnotation != null) {
if (runtimeClassesHandleMode == RuntimeClassesHandleMode.IGNORE) {
return null;
}
else if (runtimeClassesHandleMode == RuntimeClassesHandleMode.THROW) {
throw new IllegalStateException(
"classpath is configured incorrectly:" +
" class " + qualifiedName + " from runtime must not be loaded by compiler");
}
else {
throw new IllegalStateException("unknown parameter value: " + runtimeClassesHandleMode);
if ("jet".equals(qualifiedName.parent().getFqName())) {
PsiAnnotation assertInvisibleAnnotation = JavaDescriptorResolver
.findAnnotation(original, JvmStdlibNames.ASSERT_INVISIBLE_IN_RESOLVER.getFqName().getFqName());
if (assertInvisibleAnnotation != null) {
if (runtimeClassesHandleMode == RuntimeClassesHandleMode.IGNORE) {
return null;
}
else if (runtimeClassesHandleMode == RuntimeClassesHandleMode.THROW) {
throw new IllegalStateException(
"classpath is configured incorrectly:" +
" class " + qualifiedName + " from runtime must not be loaded by compiler");
}
else {
throw new IllegalStateException("unknown parameter value: " + runtimeClassesHandleMode);
}
}
}
@@ -61,10 +61,6 @@ public class JetMethodAnnotation extends PsiAnnotationWithFlags {
return returnType;
}
public boolean returnTypeNullable() {
return (flags() & JvmStdlibNames.FLAG_NULLABLE_RETURN_TYPE_BIT) != 0;
}
@NotNull
public String propertyType() {
checkInitialized();