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

Remove UnbannedReflectiveBuildItem + policy extension ? #699

Closed
johnpoth opened this issue Feb 11, 2020 · 10 comments · Fixed by #1677
Closed

Remove UnbannedReflectiveBuildItem + policy extension ? #699

johnpoth opened this issue Feb 11, 2020 · 10 comments · Fixed by #1677
Assignees
Milestone

Comments

@johnpoth
Copy link
Member

When a component uses the camel-api-component-maven-plugin (olingo4, box, fhir, zendesk etc...) one has to register the Configuration classes for reflection using ReflectiveClassBuildItem.
With the Policy extension, one also has to register the same classes with UnbannedReflectiveBuildItem or else the build fails.

Since these are valid uses of ReflectiveClassBuildItem I really don't think the build should fail.

@ppalaga
Copy link
Contributor

ppalaga commented Feb 11, 2020

We currently ban classes annotated with @org.apache.camel.spi.UriParams that actually should not need reflection, because there are means on the Camel site how to avoid it. If those means do not work, one should file a Camel issue or even better fix it on the Camel side. Unbanning should be seen only as a temporary measure to make things work. Registering for reflection comes at some cost (image size, runtime efficiency) and we want to avoid it whereever possible.

@lburgazzoli
Copy link
Contributor

I'd say that we should trust a little extensions developers and thus evaluation should be done mainly through the PR review process.

@johnpoth
Copy link
Member Author

I'm not sure I understand, some classes annotated with @org.apache.camel.spi.UriParams do need reflection, so why make the build fail ?

@oscerd
Copy link
Contributor

oscerd commented Feb 11, 2020

Because on the camel side there were efforts to avoid reflection and there are multiple commits where this is visible on each component. It wasn't possible to do this on all the components btw, so I agree the build should not fail.

@johnpoth
Copy link
Member Author

I agree with @lburgazzoli, @oscerd
Build failures should really only occur in critical situations. IMO this hurts the overall developer experience here

@ppalaga
Copy link
Contributor

ppalaga commented Feb 11, 2020

I am sorry for the inconvenience, but I still think that registering a class for reflection that belongs to a well known group that is expected not to need it, should not go without checking it properly.

Speaking for me, I do not feel able to eval during the review by pure sight whether some Camel class has some specific annotation. I think the policy does some useful work there. If we really want to tackle this, we should keep the policy.

Going through tens of extensions manually afterwards to check whether we register for reflection only what is necessary is a lot of work, that I did twice and I would not wish anybody to that again.

However, if we actually do not have the ambition to do this properly, I won't be against removing the policy.

By no means this inconvenience can impact Camel Quarkus application developers unless they consciously depend on the policy extension. This is only the case in our integration tests. Failing is the right thing to do there because what does not fail the build gets ignored.

@jamesnetherton
Copy link
Contributor

As a compromise, can we not just log a message at WARN or DEBUG level if UriParams stuff is registered for reflection? At least that'll give an easy way to track stuff down for investigation.

@lburgazzoli
Copy link
Contributor

I think the warning is the right thing as it also avoid to keep a list of white listed classes (that needs to be maintained)

@ppalaga
Copy link
Contributor

ppalaga commented Feb 11, 2020

OK, accepting that the policy is not seen as useful by the majority and thus also switching to passive mode for the solving of the underlying problem.

@davsclaus
Copy link
Contributor

davsclaus commented Aug 6, 2020

All the Camel components now do not use reflection when configuring themselves. We have those generated Configurer classes today. Today we fixed one (hopefully last) issue in the api components that @jamesnetherton discovered. Thats fixed in Camel 3.5 onwards (backported to 3.4.3 also)

@jamesnetherton jamesnetherton self-assigned this Sep 2, 2020
jamesnetherton added a commit to jamesnetherton/camel-quarkus that referenced this issue Sep 2, 2020
jamesnetherton added a commit that referenced this issue Sep 2, 2020
@jamesnetherton jamesnetherton added this to the 1.1.0 milestone Sep 9, 2020
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 a pull request may close this issue.

6 participants