Annotation does not support array value?


#1

Can not apply Produces @annotation to class:

  Java File 1:

package javax.ws.rs;

@java.lang.annotation.Inherited

@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD})

@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)

public @interface Produces {

  java.lang.String[] value() default {"*/*"};

}

  Java File 2:

@Produces( { MediaType.APPLICATION_JSON, "text/json" })

abstract class Entity ....

  Kotlin File :
  class Customer : Entity  …

For now it will throw Exception:

java.lang.ClassCastException: com.intellij.psi.impl.compiled.ClsArrayInitializerMemberValueImpl cannot be cast to com.intellij.psi.PsiLiteralExpression

at org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver.resolveAnnotation(JavaDescriptorResolver.java:1621)

at org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver.resolveAnnotations(JavaDescriptorResolver.java:1591)

at org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver.createJavaClassDescriptor(JavaDescriptorResolver.java:387)

at org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver.resolveClass(JavaDescriptorResolver.java:368)

at org.jetbrains.jet.lang.resolve.java.JavaPackageScope.getClassifier(JavaPackageScope.java:56)

at org.jetbrains.jet.lang.resolve.scopes.WritableScopeWithImports.getClassifier(WritableScopeWithImports.java:171)

So it seems array value in annotation is not supported yet, isn't it ? Thanks.

Outersky


#2

BTW: 0.1-snapshot version is used here , and it's a maven project.


#3

This is clearly a bug. Please, report it to the tracker. Thanks.


#4

REPORTED: KT-2965