You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/12/12 10:32:29 UTC

[Bug 47214] Inner classes that are explicitly referenced - should not be anonymous

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

--- Comment #6 from Konstantin Kolinko <kn...@gmail.com> ---
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.

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