Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1423

Invalid cast from DefinitionException to WeldException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.0.1.Final
    • 2.0.0.CR4
    • None
    • None

      This line of code throws a ClassCastException:

      https://github.com/weld/core/blob/2.0/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java#L200

      The problem is that neither DeploymentException or DefinitionException can be cast to a WeldException.

      FYI: I get this issue when I try to use the following Interceptor binding annotation:

      @Inherited
      @InterceptorBinding
      @Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
      @Target({ElementType.TYPE, ElementType.METHOD})
      public @interface Transactional {
            TxType value() default TxType.REQUIRED;
       
        public enum TxType {
            REQUIRED,
            REQUIRES_NEW,
            MANDATORY,
            SUPPORTS,
            NOT_SUPPORTED,
            NEVER
        }
      
        Class[] rollbackOn() default {};
      
        Class[] dontRollbackOn() default {};
      
      }
      

      It fails for the following reason (which I am pursuing independently to this jira issue).

      org.jboss.weld.exceptions.DefinitionException: WELD-001101 Member of array type or annotation type must be annotated @NonBinding:  [EnhancedAnnotatedMethodImpl] public abstract javax.transaction.Transactional.rollbackOn()
      

            rhn-engineering-jharting Jozef Hartinger
            paul.robinson@redhat.com Paul Robinson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: