Skip to content

Clean up package structure - #3233

Merged
joschi merged 8 commits into
release/3.0.xfrom
package-core
Mar 20, 2022
Merged

joschi merged 8 commits into
release/3.0.xfrom
package-core

Conversation

@joschi

@joschi joschi commented Apr 6, 2020 •

Copy link
Copy Markdown
Member

In order to properly support the Java Platform Module System (JPMS), the packages in modules must not overlap, or put differently, the packages may not be split into multiple modules.

See also: https://nipafx.dev/java-9-migration-guide/#split-packages

This change set cleans up the overlapping package structure where necessary (and is unfortunately breaking backward compatibility).

Affected packages:

  • dropwizard-core: io.dropwizard -> io.drowizard.core
  • dropwizard-views: io.dropwizard.views -> io.dropwizard.views.common
  • dropwizard-metrics: io.dropwizard.metrics -> io.dropwizard.metrics.common
  • dropwizard-logging: io.dropwizard.logging -> io.dropwizard.logging.common

Refs #2926
Refs #3131
Refs #3654

@joschi joschi added this to the 2.1.0 milestone Apr 6, 2020
@joschi
joschi requested a review from a team April 6, 2020 20:20
@joschi joschi self-assigned this Apr 6, 2020
@joschi

joschi commented Apr 6, 2020

Copy link
Copy Markdown
Member Author

io.dropwizard.metrics -> io.dropwizard.metrics.{common, core}

Not sure about that one yet. Do you have any preferences?

nickbabcock
nickbabcock previously approved these changes Apr 8, 2020

@nickbabcock nickbabcock left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah looks like the structure needed to be cleaned up to be compliant. Thanks for this and making it backwards compatible.

You also mentioned

We'll need more tests to see, if everything works with Java 9+ ; when using the module path

I'm not sure how one would test the module path. Were you able to include them in the PR?

io.dropwizard.metrics -> io.dropwizard.metrics.{common, core}

I'd say, unless you want to make everything use the core suffix, having io.dropwizard.metrics match logging and views with the common suffix make sense

@pkwarren

pkwarren commented Apr 8, 2020 •

Copy link
Copy Markdown
Contributor

I'm worried that the actual changes aren't going to be backwards compatible - if we end up changing the locations of classes it could break consumers.

For example, by changing to contract superclass (i.e. from io.dropwizard.Configuration to io.dropwizard.core.Configuration), we may break compatibility. http://wiki.eclipse.org/Evolving_Java-based_APIs_2 is a great reference for these sorts of changes to know the impact. We can also run a tool like https://lvc.github.io/japi-compliance-checker/ to verify the API contract hasn't changed. OkHttp also just updated from Java to Kotlin (https://square.github.io/okhttp/upgrading_to_okhttp_4/) and recommended use of https://github.com/siom79/japicmp to verify no API changes.

If we can't make this backwards compatible, then we might want to consider this for a 3.x release and change groupId, package name, and introduce compat packages if we want to support existing codebases. For example:

  • Add io.dropwizard:dropwizard3-core which includes package io.dropwizard3.*
  • Add io.dropwizard:dropwizard3-core-compat artifact which includes all classes from dropwizard-core 2.x package which is deprecated and extend dropwizard3-core classes.
  • Update io.dropwizard:dropwizard-core to pull in dropwizard3-core and dropwizard3-core-compat artifacts. This way existing dependencies work unchanged.

@joschi joschi linked an issue May 9, 2020 that may be closed by this pull request
@github-actions github-actions Bot added the stale Stale issue or pull request which will be closed soon label Oct 27, 2020
@dropwizard dropwizard deleted a comment from github-actions Bot Oct 27, 2020
@joschi joschi removed the stale Stale issue or pull request which will be closed soon label Oct 27, 2020
@joschi

joschi commented Apr 12, 2021

Copy link
Copy Markdown
Member Author

After playing around with this branch a little bit more I couldn't come up with a way to not break backward compatibility in one way or the other.

So I think it makes sense to rip off the bandaid and introduce the breaking change in Dropwizard 2.1.0 to be done with it.

Going forward, this would mean that Dropwizard could be compatible to the JPMS and no other package renaming would have to be done.

The other possibility would be to postpone this change to Dropwizard 3.0.0 and do it together with the move to the Jakarta EE namespace (Jetty 11, Jersey 3, Hibernate Validator 7, etc.) and the Java 11 baseline (or drop this altogether).

@dropwizard/committers Any opinions?

@joschi
joschi marked this pull request as ready for review April 12, 2021 06:55
@sonarqubecloud

Copy link
Copy Markdown

@jplock

jplock commented Apr 12, 2021

Copy link
Copy Markdown
Member

@joschi I think this would surprise people in 2.1.0 even if we heavily documented it. I'd be in favor of starting 3.x with the changes you proposed and maybe at the same time saying 1.x would no longer be maintained/supported (even bug fixes), to encourage people to upgrade to at least 2.x.

@joschi

joschi commented Apr 12, 2021

Copy link
Copy Markdown
Member Author

and maybe at the same time saying 1.x would no longer be maintained/supported

@jplock Thankfully we already did that with Dropwizard 1.3.29. 😃

I don't have a strong opinion on whether to to this change in Dropwizard 2.1.x or 3.0.x.

The only thing which might not be desirable is mixing too many breaking changes into Dropwizard 3.0.x.

@pstackle

Copy link
Copy Markdown
Contributor

I'll put in a vote for holding off the change until a 3.0 release. Having breaking changes is much more expected for a major version bump compared to a minor version bump.

@joschi joschi modified the milestones: 2.1.0, 3.0.0 Apr 25, 2021
@github-actions github-actions Bot added the stale Stale issue or pull request which will be closed soon label Oct 23, 2021
@joschi joschi removed the stale Stale issue or pull request which will be closed soon label Oct 23, 2021
@dropwizard dropwizard deleted a comment from github-actions Bot Oct 23, 2021
@zUniQueX

zUniQueX commented Mar 1, 2022

Copy link
Copy Markdown
Member

The only thing which might not be desirable is mixing too many breaking changes into Dropwizard 3.0.x.

Thanks to our current upgrade plans, Dropwizard 3.0.x won't introduce that much API changes. Since Jersey will bring JPMS support firstly in 3.1.0 on the jakarta namespace, we don't even have the need to bring this to DW 3. But I see no problem bringing this to the 3.0.0 release.

@joschi
joschi changed the base branch from master to release/3.0.x March 4, 2022 11:35
@joschi
joschi requested a review from a team March 4, 2022 15:26
@joschi
joschi requested a review from nickbabcock March 4, 2022 15:38
@joschi
joschi dismissed nickbabcock’s stale review March 4, 2022 15:39

Rebased on release/3.0.x branch

@joschi

joschi commented Mar 4, 2022

Copy link
Copy Markdown
Member Author

@dropwizard/committers I've rebased the branch on release/3.0.x.

Comment thread docs/source/getting-started.rst Resolved

@zUniQueX zUniQueX left a comment •

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.

@joschi This looks very good, thanks for the effort ❤️

I just have a few minor suggestions:

  • DefaultServerFactoryTest:18-19 multiple imports for Environment and ExceptionMapperBinder
  • SimpleServerFactoryTest:17 multiple imports for Environment
  • JdbiTest:8 multiple imports for Environment
  • getting-started.rst:196 broken import
  • configuration.rst:892 package logging.common instead of logging.filter.common
  • FilterFactory:15 broken JavaDoc

And one question left: Could it become a problem, that the packages in dropwizard-e2e and dropwizard-example are named com.example and com.example.helloworld?

@joschi
joschi requested review from a team and zUniQueX March 13, 2022 15:26
@joschi joschi added improvement java Pull requests that update Java code labels Mar 13, 2022
@joschi

joschi commented Mar 20, 2022 •

Copy link
Copy Markdown
Member Author

@zUniQueX Thanks for the detailed look at this PR! ❤️

And one question left: Could it become a problem, that the packages in dropwizard-e2e and dropwizard-example are named com.example and com.example.helloworld?

No, these are not an issue because neither is being published and consumed by other projects and they never end up in the same application and module path.

@joschi
joschi enabled auto-merge (squash) March 20, 2022 20:47
@zUniQueX

Copy link
Copy Markdown
Member

And one question left: Could it become a problem, that the packages in dropwizard-e2e and dropwizard-example are named com.example and com.example.helloworld?

No, these are not an issue because neither is being published and consumed by other projects and they never end up in the same application and module path.

Okay, thanks for taking a look at this 👍

@joschi
joschi merged commit 002f8dd into release/3.0.x Mar 20, 2022
@joschi
joschi deleted the package-core branch March 20, 2022 20:57
@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 35 Code Smells

82.7% 82.7% Coverage
0.6% 0.6% Duplication

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

Labels

improvement java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JPMS - split package io.dropwizard.validation

6 participants