Open agentgt opened 2 days ago
The other advantage to this is if one actually did want to call the method they can use the more modern and in theory faster MethodLookup
API.
We can probably add it, but either this way or just enabling the option in jooby-apt will require you to update all your projects, no?
Correct.
The code change is minor as that is one place but the compiler flag is not because of Maven limitations.
I’m proposing it because it is the right thing to do. We should not kick off reflection on initialization.
Ok, send a PR so we can release 3.4.0 with the change
@jknack This probably a silly question but I assume we are still targeting jDK 17 for 3.4.0 correct? I'm fairly sure but just want to check.
absolutely. jooby 4.0 will be 21
Currently
setMvcMethod
andgetMvcMethod
are ajava.lang.reflect.Method
.The original impetus for
set/getMvcMethod
was for metrics and the actualjava.lang.reflect.Method
is not even needed but rather method name and signature.I propose based on this comment: https://github.com/jooby-project/jooby/issues/3529#issuecomment-2353089543
That we replace get/setMvcMethod(io.jooby.MvcMethod method).
MvcMethod
type would have enough metadata so that one could get thejava.lang.reflect.Method
dynamically if desired.This will avoid reflective lookup during registration regardless of whether nor
setMvcMethod
is enabled or not.I can do a PR for this for 3.4.0 depending on timeline of 3.4.0