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

Ensure that final methods don't prevent CDI interceptors from being applied #5104

Merged
merged 1 commit into from
Nov 13, 2019

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Oct 31, 2019

We need security annotations to result in the creation of an interceptor
which is not possible when a method is final.
The solution we follow is to remove the final modifier from methods
that need intercepting.
This is now configurable with the default value true, meaning that
Arc will remove the final flag. If the value is set to false
Arc throws an exception at build time.

Fixes: #5051

Provides an alternative implementation to #5089 (which has now been closed) based on this comment

@geoand geoand changed the title Ensure that Security annotation are always places on non-final methods Ensure that final methods don't prevent CDI interceptors from being applied Oct 31, 2019
@stuartwdouglas stuartwdouglas requested a review from mkouba October 31, 2019 23:14
@geoand geoand force-pushed the #5051-take2 branch 2 times, most recently from a18b5c7 to 28a35e4 Compare November 1, 2019 07:35
@geoand geoand added the area/arc Issue related to ARC (dependency injection) label Nov 1, 2019
@geoand geoand added this to the 0.28.0 milestone Nov 1, 2019
@geoand
Copy link
Contributor Author

geoand commented Nov 1, 2019

I need to rebase this on top of #5108

@geoand
Copy link
Contributor Author

geoand commented Nov 1, 2019

This is now rebased on top of #5108.

@geoand geoand requested a review from gsmet November 1, 2019 10:04
@geoand geoand removed this from the 0.28.0 milestone Nov 1, 2019
@geoand
Copy link
Contributor Author

geoand commented Nov 1, 2019

I cleared the milestone since it remains to be decided if it should go in for 0.28

@geoand geoand force-pushed the #5051-take2 branch 2 times, most recently from c442157 to bd0a231 Compare November 1, 2019 11:06
@gsmet gsmet added the triage/on-ice Frozen until external concerns are resolved label Nov 1, 2019
@gsmet
Copy link
Member

gsmet commented Nov 1, 2019

Decision on this one is to wait a bit and see the feedback we have on Martin's changes before deciding if we should take the risk to include it pre 0.29.0.

@geoand geoand force-pushed the #5051-take2 branch 2 times, most recently from b8c9ee7 to 8ca1da3 Compare November 1, 2019 12:46
@geoand
Copy link
Contributor Author

geoand commented Nov 8, 2019

Note to self: rebase onto master and get this one in for 1.1

@geoand geoand removed the triage/on-ice Frozen until external concerns are resolved label Nov 9, 2019
@geoand
Copy link
Contributor Author

geoand commented Nov 9, 2019

@mkouba @gsmet should we get this one in for 1.1?

@geoand geoand force-pushed the #5051-take2 branch 2 times, most recently from 8727c29 to 2456efd Compare November 9, 2019 09:36
@geoand geoand requested a review from manovotn November 11, 2019 09:25
Copy link
Contributor

@manovotn manovotn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me and +1 for tests for both cases right away!
I am not familiar with ClassVisitor pattern, so take my review there with a pinch of salt, but it does seem to do what I'd expect it to do ;-)

@geoand
Copy link
Contributor Author

geoand commented Nov 11, 2019

Thanks for the review @manovotn!

I'll wait for another review then :)

@geoand
Copy link
Contributor Author

geoand commented Nov 11, 2019

@mkouba / @stuartwdouglas are you good with this?

@stuartwdouglas
Copy link
Member

LGTM but I will let @mkouba have the final say.

Copy link
Contributor

@mkouba mkouba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! The only thing I'm missing is a log message that a final modifier was removed. I know that users usually don't care about these messages but it's a good habit that helps with debugging ;-).

@stuartwdouglas
Copy link
Member

It should be debug level though

@geoand
Copy link
Contributor Author

geoand commented Nov 12, 2019

I added a debug level logging message

@geoand geoand requested a review from mkouba November 12, 2019 08:01
@mkouba
Copy link
Contributor

mkouba commented Nov 12, 2019

[ERROR] Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.8.1:validate (default) on project arc-processor: File '/home/vsts/work/1/s/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java' has not been previously formatted. Please format file and commit before running validation! -> [Help 1]
[ERROR]

@geoand ;-)

@mkouba mkouba added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Nov 12, 2019
@geoand
Copy link
Contributor Author

geoand commented Nov 12, 2019

[ERROR] Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.8.1:validate (default) on project arc-processor: File '/home/vsts/work/1/s/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java' has not been previously formatted. Please format file and commit before running validation! -> [Help 1]
[ERROR]

@geoand ;-)

LOL, I'll fix it :)

@geoand geoand added this to the 1.1.0 milestone Nov 12, 2019
We need security annotations to result in the creation of an interceptor
which is not possible when a method is final.
The solution we follow is to remove the final modifier from methods
that need intercepting.
This is now configurable with the default value true, meaning that
Arc will remove the final flag. If the value is set to false
Arc throws an exception at build time.

Fixes: quarkusio#5051
@geoand geoand merged commit 17faac6 into quarkusio:master Nov 13, 2019
@geoand geoand deleted the #5051-take2 branch November 13, 2019 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection) triage/waiting-for-ci Ready to merge when CI successfully finishes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quarkus 0.27 - JWT role validation does not work
5 participants