Skip to content

GWT Compilation failing with Enum in annotation #9615

@bendol-i3

Description

@bendol-i3

GWT version: 2.8.2
Browser (with version): NA
Operating System: Windows 10


Description

Attempting to compile I receive:

[INFO] Caused by: java.lang.reflect.InvocationTargetException
[INFO] 	at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
[INFO] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] 	at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] 	at com.google.gwt.dev.javac.AnnotationProxyFactory$AnnotationProxyInvocationHandler.invoke(AnnotationProxyFactory.java:248)
[INFO] 	... 76 more
[INFO] Caused by: java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object;
[INFO] 	at com.google.gwt.dev.javac.AnnotationProxyFactory$AnnotationProxyInvocationHandler.toString(AnnotationProxyFactory.java:271)
[INFO] 	... 80 more
[INFO]       Rebinding org.jboss.errai.marshalling.client.api.MarshallerFactory
[INFO]          Invoking generator org.jboss.errai.marshalling.rebind.MarshallersGenerator
[INFO]             Generating Marshallers Bootstrapper...
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Device {

    Type value() default Type.ANY;

    enum Type {
        MOBILE,
        TABLET,
        ANY
    }
}
@Device(Device.Type.MOBILE)
public class MyClass {

}

This is throwing an undescriptive exception.

Full stack trace: https://gist.github.com/bendol-i3/d80d3ef3353521b7b99519314f073136

Steps to reproduce

Setup the annotation like above, then inside of a code generator call:

  if (getAnnotations() != null) {
        for (final Annotation a : getAnnotations()) {
          logger.info(a.toString());
        }
  }

Unless there is something funky going on, on my end that should throw the exception.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions