Classes o.a.catalina.security.SecurityClassLoad o.a.catalina.jasper.SecurityClassLoad perform preloading of certain classes of Tomcat. My concern is that some of those preloaded classes are anonymous ones, e.g. loader.loadClass (basePackage + "session.StandardSession"); loader.loadClass (basePackage + "session.StandardSession$1"); Referencing anonymous classes by their numbers is too fragile. It can be broken by any code modification that will cause their renumbering. Also, it is hard to review patches to SecurityClassLoad when they contain such references. See e.g. r721704 I suggest that all such classes were explicitly named. See classes referenced in o.a.catalina.security.SecurityClassLoad for an example (e.g.: o.a.c.core.ApplicationDispatcher with inner classes PrivilegedForward, PrivilegedInclude).
What do you suggest that classes be named?
I think any reasonably descriptive name will do. If you're considering preparing a patch, please grab the latest trunk (currently Tomcat 9.0.x) and write your initial patch for that version. Once it's been accepted, that patch can be back-ported to older versions of Tomcat. Try to make your patches as small as possible: don't fix 3 bugs at once and change all the whitespace around. If you need to re-factor some things, submit two patches: the refactoring in the first patch with no functional changes, and then the actual change in a second patch.
Thank you for your advices and your time :), the problem is i'm not native english speaker and english is my fourth language, so i didn't find good names, but i will try my best, thank you again for your time :)
Your English is great. If there is confusion, we will ask for clarification. Don't feel bad if we ask you to re-do your patch(es) several times. The goal is to get the best patch possible, and make you into a successful patch-writer ;)
Fixed in 9.0.x for 9.0.0.M20 onwards. I do not propose to back-port it.
See "Re:r1817800" thread for Tomcat 7 (fix for bug 61886) http://tomcat.markmail.org/thread/y5yyhse2rsrgg35b Java 6 generates helper anonymous classes when the code uses switch(enum). E.g. in Tomcat 7 org.apache.coyote.http11.AbstractHttp11Processor$1 is static class AbstractHttp11Processor$1 { static final int $SwitchMap$org$apache$coyote$ActionCode[]; static final int $SwitchMap$org$apache$tomcat$util$log$UserDataHelper$Mode[]; static { // the int arrays are initialized with Enum.ordinal() -> some integer value mapping } } Essentially, it is a holder class that wraps a static field that is initialized lazily. https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom There is no way to assign a name to such class. As such, I went with an alternative implementation that uses a for(int++) loop to load all available classes starting with $1 - r1817901. This will be in 7.0.84 onwards.
Reassigning to Tomcat 8 to track forward-porting of r1817901.
Nice fix. Since Tomcat 8 doesn't support the old JDKs, then it probably doesn't need the clever hack (IMO). The improvement should still be to stop using anonymous inner classes when they need preload.
(In reply to Remy Maucherat from comment #8) > Nice fix. Since Tomcat 8 doesn't support the old JDKs, then it probably > doesn't need the clever hack (IMO). The improvement should still be to stop > using anonymous inner classes when they need preload. Http11Processor$1.class is present in Tomcat 8.5.24/tomcat-coyote.jar Decompiling it, it is the same $SwitchMap$ support class.
(In reply to Konstantin Kolinko from comment #7) > Reassigning to Tomcat 8 to track forward-porting of r1817901. + r1820543 Applied to Tomcat 8.5 in r1820546 Applied to Tomcat 8.0 in r1820550 SecurityClassLoad classes in Tomcat 9.0 do not load any anonymous inner classes. Thus there is no need for this fix in Tomcat 9.