Bug 47214 - Inner classes that are explicitly referenced - should not be anonymous
Summary: Inner classes that are explicitly referenced - should not be anonymous
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement with 1 vote (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-17 18:32 UTC by Konstantin Kolinko
Modified: 2017-04-06 22:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2009-05-17 18:32:20 UTC
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).
Comment 1 Abdessamed MANSOURI 2016-04-27 14:18:18 UTC
What do you suggest that classes be named?
Comment 2 Christopher Schultz 2016-04-28 02:56:41 UTC
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.
Comment 3 Abdessamed MANSOURI 2016-04-28 09:05:20 UTC
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 :)
Comment 4 Christopher Schultz 2016-04-28 14:58:46 UTC
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 ;)
Comment 5 Mark Thomas 2017-04-06 22:06:34 UTC
Fixed in 9.0.x for 9.0.0.M20 onwards. I do not propose to back-port it.