-
Notifications
You must be signed in to change notification settings - Fork 76
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
Quick-fix for Import-Package resolution failure due to missing mandatory attributes #678
base: master
Are you sure you want to change the base?
Conversation
Test Results 255 files - 29 255 suites - 29 31m 6s ⏱️ - 12m 24s For more details on these failures, see this check. Results for commit aabd31d. ± Comparison against base commit 1d5bd08. This pull request removes 2627 tests.
♻️ This comment has been updated with latest results. |
Thank you @alshamams. I'll performe a more detailed review this/tomorrow evening. |
|
Thank you @HannesWell ! |
I think closed by mistake |
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.
lgtm
caf4ec5
to
5e44df0
Compare
String[] mandatories = (String[]) exportDirectives.get(Constants.RESOLUTION_MANDATORY); | ||
for (String mandatory : mandatories) { | ||
if (importAttributes == null || !importAttributes.containsKey(mandatory) | ||
|| importAttributes.get(mandatory).toString() != exportAttributes |
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.
You should (almost) never compare strings by their reference, since it is easy to have different string object with the same content.
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.
I looked into this and in general this worked, nice job so far.
But there were a few places that needed fine-tuning (e.g. enhanced messages) or could be simplified/imported. I pushed another commit with those suggests.
What's currently missing is the handling in case there are multiple providers that export a package but with different attribute values.
In my suggestion commit I already made a change to get all exporters of a package, but it still has to be implemented that those multiple providers are considered in the error resolution.
This should be combined with the consideration of multiple mandatory/not-mandatory attributes.
I think it would be best to iterate over all exporters and create one resolution per exporter that each sets all mandatory attributes to the exporters value and set all non-mandatory attributes to the exporter's value, if the importer has another value.
Besides that a few test cases would be good. They could probably be added to BundleErrorReporterTest
.
I think it would be great if this is already offered at the time when importing the package, maybe also add support for the import version as well. |
That would be great but also would make this task much greater since the proposal would need to be enhanced as well. We could certainly do that, but I suggest we keep this focused on enhancing the error messages/quick-fix and leave the enhancement of the Import-Package proposals for a follow up. |
Hi @HannesWell , Can you also have a look at the resolution window for the Quick Fix and suggest possible improvements, if any? Thanks in advance. |
Thanks. I will review it as soon as possible (probably in the next days). |
Sure but I think the main problem is that an invalid package import is added at the first place. @alshamams you should rebase (and maybe squash) your commits here. |
8ff8263
to
7a21d1c
Compare
7a21d1c
to
8a7cad3
Compare
Hi @laeubi , @HannesWell, |
Sorry for the delay. Will review this ASAP. |
Hi @laeubi , @HannesWell, |
8a7cad3
to
76b29c6
Compare
76b29c6
to
2cce3ce
Compare
2cce3ce
to
aa3c4d8
Compare
aa3c4d8
to
aabd31d
Compare
When a package is imported that has been exported with mandatory attributes, following are the possibilities:
This commit aims to provide a quick-fix that queries the mandatory attributes and supplies them at the import site.
Fixes: #578