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

Make sure quarkus-extension.yaml can be parsed using CatalogMapperHelper #21661

Merged
merged 1 commit into from
Nov 25, 2021

Conversation

aloubyansky
Copy link
Member

This fixes a regression in codestart testing when quarkus-extension.yaml are parsed after the extension catalog API and JSON binding refactoring change.

@quarkus-bot quarkus-bot bot added area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform labels Nov 23, 2021
@aloubyansky
Copy link
Member Author

I'll need to add a test making sure quarkus-extension.yaml can be deserialized.

final ExtensionCatalog.Mutable mutableCatalog = extensionCatalog instanceof ExtensionCatalog.Mutable
? (ExtensionCatalog.Mutable) extensionCatalog
: extensionCatalog.mutable();
extensions.forEach(mutableCatalog::addExtension);
this.extensionCatalog = extensionCatalog;
Copy link
Member

Choose a reason for hiding this comment

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

Should we be using a built catalog in the event we had to change it / add extensions?

}
extensions.addAll(extensionCatalog.getExtensions());
((ExtensionCatalog.Mutable) extensionCatalog).setExtensions(extensions);
final ExtensionCatalog.Mutable mutableCatalog = extensionCatalog instanceof ExtensionCatalog.Mutable
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make the mutable() return this in ExtensionCatalog.Mutable implementations? It feels wrong to check for an instanceof first

Copy link
Member

Choose a reason for hiding this comment

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

mutable() acts as a copy constructor, "create a new thing based on this current thing". If mutable() returns this, that ability goes away.

Note that I'll be hitting all of this code again (in a second pass), trying to hide more things.. so it may be that this check goes away for other reasons...

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps there should also be clone()?

Copy link
Member Author

Choose a reason for hiding this comment

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

And mutable() would return this for a mutable instance.

Copy link
Member

Choose a reason for hiding this comment

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

Do you want to do that with this fix? Or defer to next round.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can but this there is also no rush if you like to think about it more. Let me know what you prefer.

Copy link
Member

Choose a reason for hiding this comment

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

Let me do it in the next rev.. so I can make sure there aren't any knock-on effects.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, thanks!

@aloubyansky aloubyansky force-pushed the extension-yaml-parsing branch from 107861b to a6c5cd6 Compare November 24, 2021 20:55
@aloubyansky aloubyansky force-pushed the extension-yaml-parsing branch from a6c5cd6 to c34e734 Compare November 24, 2021 21:07
@aloubyansky
Copy link
Member Author

@ebullient I added a test

@gastaldi gastaldi merged commit b935ab6 into quarkusio:main Nov 25, 2021
@quarkus-bot quarkus-bot bot added this to the 2.6 - main milestone Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants