-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark JAX-RS application classes as un-removable #1919
Conversation
@@ -340,6 +344,13 @@ public void build( | |||
servletContextParams.produce(new ServletInitParamBuildItem("resteasy.servlet.mapping.prefix", path)); | |||
if (appClass != null) { | |||
servletContextParams.produce(new ServletInitParamBuildItem(JAX_RS_APPLICATION_PARAMETER_NAME, appClass)); | |||
final String finalAppClass = appClass; // horrible java :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not make the appClass
variable final above? Looking at the code above, it would make it more readable.
That being said, I think @mkouba had another fix in mind.
Still not convinced it's a good idea to do things like that for every component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure things would be cleaner?
I don't think that making appClass
final
will be cleaner, since it uses "coupled" to app
(along with path
). I mean we could obviously extract a method and create a container class to make things final, but the rest of the code base doesn't use that approach. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it just about changing things to:
final String path;
final String appClass;
if (!app.isEmpty()) {
AnnotationInstance appPath = app.iterator().next();
path = appPath.value().asString();
appClass = appPath.target().asClass().name().toString();
} else {
path = resteasyConfig.path;
appClass = null;
}
Just saying looking at the code in GH so I might be missing obvious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG... I am SO not used to having final
variables without immediate initialization... You are of course correct! I guess this is something that everyone is used to but me :)
Closing since we will likely use a |
Fixes: #1914