Mantis - Resin
Viewing Issue Advanced Details
4883 minor always 11-29-11 03:01 11-30-11 15:56
andreaskaltenbach  
ferg  
normal  
closed 4.0.23  
fixed  
none    
none 4.0.25  
0004883: Resin generates uncompilable code for interceptors which contain enum array elements
Suppose the following enumeration:

public enum Direction {
    LEFT, MIDDLE, RIGHT;
}

which is used in an annotation @Directions;
@InterceptorBinding
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Directions {
    Direction[] value();
}

Furthermore have we a stateless session bean with an JavaEE interceptor defined:

@Named
@Stateless
@Interceptors(DirectionAware.class)
public class ServiceImpl implements Service {}

If we now annotate a method of the session bean with e.g. @Directions(value = Direction.RIGHT) , Resin will generate invalid Java code for the session bean's proxy class.

Attached, you find a little maven project to reproduce the bug.
Example output from a Resin start:
ServiceImpl__StatelessProxy.java:90: illegal start of expression
                                               public com.stendahls.interceptors.MyEnum[] value() { return [Lcom.stendahls.interceptors.MyEnum;@1d1c0f9c; }

The following, uncompilable Java code is generated:
...
_doSomething_AROUND_INVOKE_0_objectIndexChain =
        com.caucho.config.gen.CandiUtil.createInterceptors(
          __caucho_manager,
          __caucho_interceptor_static_beans,
          __caucho_interceptor_beans,
          _doSomething_AROUND_INVOKE_0_objectIndexStaticChain,
          javax.enterprise.inject.spi.InterceptionType.AROUND_INVOKE,
          new javax.enterprise.util.AnnotationLiteral<com.stendahls.interceptors.Directions>() {
            public com.stendahls.interceptors.MyEnum[] value() { return [Lcom.stendahls.interceptors.MyEnum;@734d9f9f; }
          });
...

[Lcom.stendahls.interceptors.MyEnum;@734d9f9f; in this case is unable to compile.
 bugreport.zip [^] (20,014 bytes) 11-29-11 03:01

Notes
(0005647)
ferg   
11-30-11 15:56   
ioc/0c1f