diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java index b338074012d..9b7ee1c12df 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java @@ -356,8 +356,6 @@ public class FunctionCodegen extends GenerationStateAware { } kotlinFlags |= DescriptorKindUtils.kindToFlags(functionDescriptor.getKind()); //noinspection ConstantConditions - if (functionDescriptor.getReturnType().isNullable()) - kotlinFlags |= JvmStdlibNames.FLAG_NULLABLE_RETURN_TYPE_BIT; aw.writeFlags(kotlinFlags); aw.writeTypeParameters(jvmSignature.getKotlinTypeParameter()); aw.writeReturnType(jvmSignature.getKotlinReturnType()); diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java index daaa2764d0f..2abc342250d 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java @@ -1225,8 +1225,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { else { JetType returnType = fun.getReturnType(); assert returnType != null; - if (returnType.isNullable()) - kotlinFlags |= JvmStdlibNames.FLAG_NULLABLE_RETURN_TYPE_BIT; aw.writeTypeParameters(jvmSignature.getKotlinTypeParameter()); aw.writeReturnType(jvmSignature.getKotlinReturnType()); } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java index af204690e32..d827e475e3b 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java @@ -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 { diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java index b65a40c930d..f43a425aaea 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java @@ -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"); diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiClassFinderImpl.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiClassFinderImpl.java index 2e24ee78af4..66da45adf44 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiClassFinderImpl.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiClassFinderImpl.java @@ -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); + } } } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/JetMethodAnnotation.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/JetMethodAnnotation.java index fb6f2236323..7873af880c1 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/JetMethodAnnotation.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/JetMethodAnnotation.java @@ -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();