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

Invalid Warning "not defined according to the specification"

XMLWordPrintable

      When defining an Interceptor like this:

      public class MyInterceptor {
      @PostConstruct
      public Object wrapC(InvocationContext ctx) throws Exception {
      {
          // ...
          return ctx.proceed(); // throws Exception
      }
      

      Then I get this warning by Weld:

      WARN: WELD-001471: Interceptor method wrapC defined on class com.MyInterceptor is not defined according to the specification. It should not throw java.lang.Exception, which is a checked exception.
      

      However, the javadoc of javax.annotation.PostConstruct says:

      The method defined on an interceptor class MUST HAVE one of the following signatures:
      
      void <METHOD>(InvocationContext)
      
      Object <METHOD>(InvocationContext) throws Exception 
      

      http://docs.oracle.com/javaee/7/api/javax/annotation/PostConstruct.html

      It would be nice if the warning would allow Exception for the signature with the Exception

              Unassigned Unassigned
              tkruse_jira Thibault Kruse (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: