2 Replies Latest reply on Feb 26, 2008 10:38 AM by pmuir

    Interceptors on a superclass

    cpopetz

      Is there a design reason not to scan superclasses of components for an @Interceptors declaration?   If not, would you accept a patch to make Component.initInterceptors do that in the same way initMembers does?


      Thanks,
      -Clint


      P.S. Has anyone noticed else that there's kind of an impedance mismatch between annotations and inheritance?  This isn't the first time I've run into it.  It's not often clear, from staring at an annotation's definition or its use, if it's meant to affect all subclasses.  And the implementations vary in how they treat this issue.  If we really are creating new types with this things, we need inheritance to work with those types too.

        • 1. Re: Interceptors on a superclass
          cpopetz

          Sorry, the very first line should have been ...@Interceptors annotation not declaration.  So I want to do



          @Target(TYPE)
          @Retention(RUNTIME)
          @Interceptors(SomeInterceptor.class)
          public @interface MyAnnotation { }
          



          and then have a seam component whose superclass is annotated with @MyAnnotation be intercepted with SomeInterceptor


          Right now, that's ignored, because initInterceptors only looks at annotations of the component itself.


          • 2. Re: Interceptors on a superclass
            pmuir

            Clint Popetz wrote on Feb 22, 2008 01:13 AM:


            Is there a design reason not to scan superclasses of components for an @Interceptors declaration?   If not, would you accept a patch to make Component.initInterceptors do that in the same way initMembers does?


            Submit a feature request to JIRA.




            P.S. Has anyone noticed else that there's kind of an impedance mismatch between annotations and inheritance?  This isn't the first time I've run into it.  It's not often clear, from staring at an annotation's definition or its use, if it's meant to affect all subclasses.  And the implementations vary in how they treat this issue.  If we really are creating new types with this things, we need inheritance to work with those types too.



            Yes, you aren't alone here.