On 06/04/2020 20:50, Filip Hanik wrote: > On Mon, Apr 6, 2020 at 11:20 AM Mark Thomas <ma...@apache.org > <mailto:ma...@apache.org>> wrote: > > On 06/04/2020 17:56, Filip Hanik wrote: > > Team, > > > > As I'm slowly transitioning between projects, Apache Tomcat has once > > again showed up in my workspace. I'm currently working on > improving the > > embedded experience for native images. > > > > I have a pull request,[1] <https://github.com/apache/tomcat/pull/267>, > > that I'd like to open up a discussion about > > > > Goal: Able to start embedded Apache Tomcat without using reflection. > > Do you have a test case you are working to? It would be helpful to see > exactly where the problems are in terms of what is considered reflection > and what isn't. > > > Yes, I'm working on a sample that should demonstrate it.
Excellent. > On that point, can we tell the tooling that reflection isn't used even > if the automated analysis can't tell that? I'm thinking of something > along the lines of ensuring that most execution paths - including > embedded - avoid reflection. We should, hopefully, be able to document > the scenarios where reflection is triggered so users know to avoid them. > > > This PR: Changes the constructor for Connector to not use reflection. > > Instead the calling components will instantiate the ProtocolHandler > > > > Besides the constructor change, functionality should remain backwards > > compatible. > > I am very uncomfortable changing the constructor for a fundamental > component like Connector this far into a stable release - hence wanting > to explore options. > > > Noted, I think a compromise may be in order. Where we simply add a > constructor that avoids the Class.forName > and that allows the developer to explicitly invoke a constructor that > avoids it. My thinking was more along the following lines... Rewrite the Connector (and possibly some/all other components) so that if a known class name was specified, rather than using the specified name directly via reflection we could do something like: if ("org.apache.coyote.http11.Http11NioProtocol".equals(className)) { protocol = new Http11NioProtocol(); } else if ("org... ... } else { // OK. Unrecognised class name. Use reflection ... } Would that style of approach help at all? Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org