https://bz.apache.org/bugzilla/show_bug.cgi?id=65244

            Bug ID: 65244
           Summary: annotations from @HandlesTypes are checked only at
                    class level when scanning
           Product: Tomcat 9
           Version: 9.0.45
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet
          Assignee: dev@tomcat.apache.org
          Reporter: gr.grzy...@gmail.com
  Target Milestone: -----

I have a test WAR, where one of the detected SCIs has this @HandlesTypes (for
testing purpose only):

@HandlesTypes({ Deprecated.class })

Then, in the same WAR, I have a servlet with this dummy field:

@Deprecated
public Object dummy;

`org.apache.tomcat.util.bcel.classfile.JavaClass#getAnnotationEntries()`
returns null for this servlet class inside
`org.apache.catalina.startup.ContextConfig#checkHandlesTypes()`

I know it's artificial and I (later, after scanning) get a list of these
classes passed to SCI:

{org.ops4j.pax.web.samples.war.scis.SCIFromTheWab1@2927}  ->
{java.util.HashSet@3017}  size = 9
 key: org.ops4j.pax.web.samples.war.scis.SCIFromTheWab1  =
{org.ops4j.pax.web.samples.war.scis.SCIFromTheWab1@2927} 
 value: java.util.HashSet  = {java.util.HashSet@3017}  size = 9
  0 = {@3023} "class javax.faces.component.UIViewRoot$ViewScope"
  1 = {@3024} "class org.apache.myfaces.view.facelets.tag.jsf.ComponentHandler"
  2 = {@3025} "class org.apache.myfaces.view.facelets.tag.jsf.ConvertHandler"
  3 = {@3026} "class javax.faces.view.facelets.ResourceResolver"
  4 = {@3027} "class org.apache.myfaces.application.StateCacheFactory"
  5 = {@3028} "class org.apache.myfaces.shared.taglib.UIComponentTagUtils"
  6 = {@3029} "interface javax.faces.bean.package-info"
  7 = {@3030} "class org.apache.myfaces.view.facelets.tag.jsf.ValidateHandler"
  8 = {@3031} "class org.apache.myfaces.view.facelets.tag.MetaRule"

Each of the classes are annotated with @Deprecated.

The problem (?) I found is that chapter "8.2.4 Shared libraries / runtimes
pluggability" of Servlet 4 specification says:

> In addition to the ServletContainerInitializer we also have an annotation -
HandlesTypes. The HandlesTypes annotation on the implementation of the
ServletContainerInitializer is used to express interest in classes that may
have annotations ___(type, method or field level annotations)___ specified in
the value of
the HandlesTypes or if it extends / implements one those classes anywhere in
the
class’ super types.

So either something's wrong in Tomcat, in TCK, or Servlet spec is too
permissive...

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to