10 Replies Latest reply on Feb 17, 2010 4:44 PM by Koichi Kobayashi

    Scope type without @Scope or @NormalScope

    Koichi Kobayashi Newbie

      CDI spec (2.4.2. Defining new scope types) says



      All scope types must also specify the @javax.inject.Scope or @javax.enterprise.context.NormalScope meta-annotation


      But a scope type without the @Scope or @NormalScope works well.


      1) declare scope type without @Scope or @NormalScope.


      @Target( { TYPE, METHOD, FIELD })
      @Retention(RUNTIME)
      public @interface SomeScoped {}
      


      2) register the scope.


      beforeBeanDiscovery.addScope(SomeScoped.class, true, false);
      



      3) register the context.


      afterBeanDiscovery.addContext(new SomeContext());
      



      I think that the @SomeScoped should become Error If all scope types must specify @Scope or @NormalScope.


      But Weld accept the @SomeScoped if I register it (step 2).


      Which is right?