Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Apr 8, 2019

Fixes: #1914

@geoand geoand requested review from gsmet and mkouba April 8, 2019 14:29
@@ -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 :(
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

@geoand geoand Apr 8, 2019

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 :)

@geoand
Copy link
Contributor Author

geoand commented Apr 8, 2019

Closing since we will likely use a BeanDefiningAnnotationBuildItem

@geoand geoand closed this Apr 8, 2019
@gsmet gsmet added this to the 0.13.1 milestone Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants