-
Notifications
You must be signed in to change notification settings - Fork 63
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
ChangeUnits containing Unnamed Variables (JEP443) are not found by Mongock. #646
Comments
We recently upgraded to java 21 with preview features enabled too and could not make sense of some changeunits not being picked up by mongock until reading your issue. We confirmed this issue with our codebase! |
@florian-gehring we'll take a look at this, but for the time being, as workaround, is it enough if you don't use "_"? |
@spalberg this is not the same problem. Please see this issue. |
@dieppa it's exactly the same issue as described here. When a changeunit uses the unnamed variable feature it is completely overlooked by mongock when picking up the changeunits via reflection. Not using the unnamed variable fixes that. |
I am not familiar with that feature. We'll look at it as soon as possible. In the meanwhile, yiu are welcome to raise a PR if you feel so. |
@dieppa Hello, thank you for your comment. Yes, we've commited to not using "_" so the workaround is perfectly fine. This issue is less of a "PLEASE FIX" and more of a "Just FYI". It's a preview feature after all. |
Thanks @florian-gehring for letting us know. We have a lot of new exciting things for the upcoming major release, hopefully we can add these nicr to have to it, so we are more up to date with modern java featured |
Description
ChangeUnits that contain unnamed variables (the "_" placeholder) anywhere in them, are not found or executed by Mongock. Replacing the placeholder with a named (and unused) variable will result in the ChangeUnit being found again.
PRIORITY
NORMAL / Not Sure
Version and environment
Mongock
Environment
Steps to Reproduce
.map(document -> (AggregationOperation) _ -> document)
somewhere in a stream.Behaviour
Expected behavior: The ChangeUnit gets executed
Actual behavior: Mongock does not find the ChangeUnit.
How often the bug happens: Every time.
Additional context
The reflection library Mongock uses apparently can't return classes containing these features.
In ChangeLogServiceBase.java:163 the ChangeUnit class is present in the Object constructed by
new Reflections(changeLogsBasePackageList)
but thegetTypesAnnotatedWith(ChangeUnit.class)
returns an empty list, if the "_"-Placeholder is used anywhere in the file.The text was updated successfully, but these errors were encountered: