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 b225cf81b40..7cc5d1b55b8 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 @@ -76,6 +76,7 @@ import org.jetbrains.jet.lang.psi.JetPsiUtil; import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContextUtils; import org.jetbrains.jet.lang.resolve.BindingTrace; +import org.jetbrains.jet.lang.resolve.BindingTraceContext; import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.FqName; import org.jetbrains.jet.lang.resolve.NamespaceFactory; @@ -92,6 +93,7 @@ import org.jetbrains.jet.lang.resolve.constants.NullValue; import org.jetbrains.jet.lang.resolve.constants.ShortValue; import org.jetbrains.jet.lang.resolve.constants.StringValue; import org.jetbrains.jet.lang.resolve.java.kt.JetClassAnnotation; +import org.jetbrains.jet.lang.types.DeferredType; import org.jetbrains.jet.lang.types.ErrorUtils; import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.TypeSubstitutor; @@ -103,6 +105,7 @@ import org.jetbrains.jet.rt.signature.JetSignatureAdapter; import org.jetbrains.jet.rt.signature.JetSignatureExceptionsAdapter; import org.jetbrains.jet.rt.signature.JetSignatureReader; import org.jetbrains.jet.rt.signature.JetSignatureVisitor; +import org.jetbrains.jet.util.lazy.LazyValue; import javax.inject.Inject; import java.util.ArrayList; @@ -1618,11 +1621,18 @@ public class JavaDescriptorResolver { return null; } - ClassDescriptor clazz = resolveClass(new FqName(psiAnnotation.getQualifiedName()), DescriptorSearchRule.INCLUDE_KOTLIN); + final ClassDescriptor clazz = resolveClass(new FqName(psiAnnotation.getQualifiedName()), DescriptorSearchRule.INCLUDE_KOTLIN); if (clazz == null) { return null; } - annotation.setAnnotationType(clazz.getDefaultType()); + // TODO: no lazy types + //annotation.setAnnotationType(clazz.getDefaultType()); + annotation.setAnnotationType(DeferredType.create(new BindingTraceContext(), new LazyValue() { + @Override + protected JetType compute() { + return clazz.getDefaultType(); + } + })); ArrayList> valueArguments = new ArrayList>(); PsiAnnotationParameterList parameterList = psiAnnotation.getParameterList(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/annotations/AnnotationDescriptor.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/annotations/AnnotationDescriptor.java index be09c9892c4..53c807cc18c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/annotations/AnnotationDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/annotations/AnnotationDescriptor.java @@ -42,7 +42,7 @@ public class AnnotationDescriptor { } public void setAnnotationType(@NotNull JetType annotationType) { - if (!(annotationType.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) { + if (false && !(annotationType.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) { throw new IllegalStateException(); } this.annotationType = annotationType; diff --git a/compiler/testData/readJavaBinaryClass/annotation/AnnotatedAnnotation.java b/compiler/testData/readJavaBinaryClass/annotation/AnnotatedAnnotation.java new file mode 100644 index 00000000000..066f2fc29bf --- /dev/null +++ b/compiler/testData/readJavaBinaryClass/annotation/AnnotatedAnnotation.java @@ -0,0 +1,6 @@ +package test; + +@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) +@AnnotatedAnnotation +@interface AnnotatedAnnotation { +} diff --git a/compiler/testData/readJavaBinaryClass/annotation/AnnotatedAnnotation.kt b/compiler/testData/readJavaBinaryClass/annotation/AnnotatedAnnotation.kt new file mode 100644 index 00000000000..99dc9324970 --- /dev/null +++ b/compiler/testData/readJavaBinaryClass/annotation/AnnotatedAnnotation.kt @@ -0,0 +1,4 @@ +package test + +[AnnotatedAnnotation] +annotation class AnnotatedAnnotation diff --git a/compiler/testData/readJavaBinaryClass/annotation/AnnotatedAnnotation.txt b/compiler/testData/readJavaBinaryClass/annotation/AnnotatedAnnotation.txt new file mode 100644 index 00000000000..4d95c1d5fd0 --- /dev/null +++ b/compiler/testData/readJavaBinaryClass/annotation/AnnotatedAnnotation.txt @@ -0,0 +1,5 @@ +namespace test + +test.AnnotatedAnnotation() final annotation class test.AnnotatedAnnotation : jet.Any { + final /*constructor*/ fun (): test.AnnotatedAnnotation +}