Skip to content

chore!: Make shared base package name be more specific - #3217

Merged
mshabarov merged 11 commits into
masterfrom
chore/export-base-module
May 24, 2022
Merged

mshabarov merged 11 commits into
masterfrom
chore/export-base-module

Conversation

@mshabarov

Copy link
Copy Markdown
Contributor

Description

Makes shared module package name to be more specific.
com.vaadin.flow.component package name already used in flow-server
so it produces a conflicts when used in OSGi environments.
Also, export directive was missing, which also produces errors.

Fixes vaadin/base-starter-flow-osgi#224

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs-beta/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

Makes shared module package name to be more specific.
com.vaadin.flow.component package name already used in flow-server
so it produces a conflicts when used in OSGi environments.
Also, export directive was missing, which also produces errors.
* the License.
*/
package com.vaadin.flow.component;
package com.vaadin.flow.component.shared.base;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not happy with the package name in general. Are there any alternatives in how we use OSGI to keep the current package name? This will impact DX, as these classes are public API for developers, and it's going to be weird that some mixin interfaces have to be imported from com.vaadin.flow.component and others from com.vaadin.flow.component.shared.base. Besides the name is very non-descript for being so specific.

If we have to change it, why use com.vaadin.flow.component.shared.base instead of com.vaadin.flow.component.shared? If package names create collisions with OSGI, how can we be sure that the new name will not conflict with anything from Flow in the future?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed to com.vaadin.flow.component.shared.
OSGi exports bundle context by specifying the packages.
I don't know how to tell OSGi to which bundle to look, if it's possible at all.
It can be so that OSGi finds the package match and looks for a class in the first bundle containing such a package.
Having commonly used classes in *.shared package is not a bad idea IMO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It would be good to have some sanity test checking that no packages from different JARs have such a conflicts, but I don't know so far how to do it rather than run the OSGi starter project and check if it's started well.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We discussed this in the team and for now it seems using a different package is the only option short-term. Reusing the same package between multiple OSGI bundles is not intended (see https://developer.ibm.com/articles/osgi-demystified-part-4-dont-bungle-your-bundles/), and while there are workarounds (see same article) it seems they would be challenging to apply to our module structure.

In terms of DX we still think developers would expect interfaces like HasClearButton to be in the same package as HasLabel, so we might want to revisit this for a future major, for example by actually combining all the com.vaadin.flow.components classes in the same Maven module, in either repository.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, the similar question is raised in SO https://stackoverflow.com/a/47327573/16650110 .
Alternative is to use OSGi Fragments (SO provides a link to docs).
But this solution looks a bit unpredictable on the first glance and would rely on the OSGi container.
The support of this Fragment feature might change in the future and we again fall back to the same issue.
At least this Fragments approach needs an investigation and tests.

I agree that the package name is better to be same for mixins.
A random idea: could we transfer them to the Flow?
Technically the shared module doesn't depend on components, so it's possible.

@sissbruecker sissbruecker May 24, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agree, fragments don't seem to be a great solution, and we might run into issues with how our projects depend on each other.

A random idea: could we transfer them to the Flow?

That would be an option, or there might also be an option to move com.vaadin.flow.components to flow-components. There are some concerns in that the interfaces we introduced are more specific to Vaadin components, while the ones in the Flow repository are more of a general nature. So we felt this requires more thought, and we should use the separate package for now, and deal with a breaking change later (which would have limited impact, since the new interfaces are probably not going to get a lot of use).

@mshabarov

Copy link
Copy Markdown
Contributor Author

VirtualListIT failed two times. It passes on my local. Looks unrelated to changes made.

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 575 Code Smells

No Coverage information No Coverage information
0.2% 0.2% Duplication

@mshabarov
mshabarov merged commit a14ce94 into master May 24, 2022
@mshabarov
mshabarov deleted the chore/export-base-module branch May 24, 2022 15:00
@vaadin-bot

Copy link
Copy Markdown
Collaborator

Hi @mshabarov and @mshabarov, when i performed cherry-pick to this commit to 23.1, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick a14ce94
error: could not apply a14ce94... refactor!: Make shared base package name be more specific (#3217)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

ZheSun88 pushed a commit that referenced this pull request May 25, 2022
Makes shared module package name to be more specific.
com.vaadin.flow.component package name already used in flow-server
so it produces a conflicts when used in OSGi environments.
Also, export directive was missing, which also produces errors.

Fixes vaadin/base-starter-flow-osgi#224

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
ZheSun88 added a commit that referenced this pull request May 25, 2022
…: 23.1) (#3224)

* refactor!: Make shared base package name be more specific (#3217)

Makes shared module package name to be more specific.
com.vaadin.flow.component package name already used in flow-server
so it produces a conflicts when used in OSGi environments.
Also, export directive was missing, which also produces errors.

Fixes vaadin/base-starter-flow-osgi#224

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>


Co-authored-by: Mikhail Shabarov <61410877+mshabarov@users.noreply.github.com>
Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 23.1.0.rc1 and is also targeting the upcoming stable 23.1.0 version.

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 23.2.0.alpha1 and is also targeting the upcoming stable 23.2.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PiT 23.1: with Vaaidn 23.1, open the start UI throws errors

3 participants