Skip to content

[cleanup][broker][Modernizer] fix violations in pulsar-broker - #17172

Merged
hangc0276 merged 3 commits into
apache:masterfrom
youzipi:modernizer-0819
Aug 24, 2022
Merged

hangc0276 merged 3 commits into
apache:masterfrom
youzipi:modernizer-0819

Conversation

@youzipi

@youzipi youzipi commented Aug 19, 2022 •

Copy link
Copy Markdown
Contributor

Master Issue: #12271 #16991

Motivation

Apply Maven Modernizer plugin to enforce we move away from legacy APIs.

Modifications

  • set failOnViolations=true
  • fix violations except broker and client packages

Verifying this change

This change is already covered by existing tests, such as (please describe tests).

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

  • doc-not-needed

- set `failOnViolations`=true
- fix violations except `broker` and `client` packages
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Aug 19, 2022
- set `failOnViolations`=true
- fix violations except `broker` and `client` packages
@youzipi

youzipi commented Aug 19, 2022

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@youzipi

youzipi commented Aug 20, 2022

Copy link
Copy Markdown
Contributor Author

@tisonkun tisonkun 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.

Thanks for your contribution!

LGTM.

@MarvinCai MarvinCai 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.

lgtm

if (starterArguments.runBookie) {
checkNotNull(bookieConfig, "No ServerConfiguration for Bookie");
checkNotNull(bookieStatsProvider, "No Stats Provider for Bookie");
Objects.requireNonNull(bookieConfig, "No ServerConfiguration for Bookie");

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.

Why change chekNotNull to Objects.requireNonNull ?

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.

I think this decision is made in #12271 where we agree on enabling the Modernizer plugin and this is the default settings.

Besides, Guava gradually deprecates Lists.newArrayList since JDK provides it out-of-the-box. This could be the same to chekNotNull to Objects.requireNonNull.

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.

guava chekNotNull and jdk Objects.requireNonNull provide the same simple semantic:

if (obj == null)
    throw new NullPointerException(message);
return obj;

@hangc0276

@youzipi

youzipi commented Aug 24, 2022

Copy link
Copy Markdown
Contributor Author

ping @codelipenghui

@hangc0276
hangc0276 merged commit 05a2ea8 into apache:master Aug 24, 2022
@hangc0276 hangc0276 added this to the 2.12.0 milestone Aug 24, 2022
Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this pull request Aug 29, 2022
…#17172)

Master Issue: apache#12271 apache#16991 

### Motivation

Apply Maven Modernizer plugin to enforce we move away from legacy APIs.

### Modifications

- set `failOnViolations`=true
- fix violations except `broker` and `client` packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants