flink icon indicating copy to clipboard operation
flink copied to clipboard

[FLINK-35733] Change org.jetbrains.annotations.NotNull to javax.annotation.Nonnull

Open RocMarshal opened this issue 1 year ago • 5 comments

What is the purpose of the change

Change org.jetbrains.annotations.NotNull to javax.annotation.Nonnull

Brief change log

Change org.jetbrains.annotations.NotNull to javax.annotation.Nonnull

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

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

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

RocMarshal avatar Jul 01 '24 05:07 RocMarshal

CI report:

  • 719788eefb8f6615e097752ea94d37d98eac3500 Azure: SUCCESS
Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

flinkbot avatar Jul 01 '24 05:07 flinkbot

Hi, @1996fanrui Could you help have a look if you had the free time ? Thank you~

RocMarshal avatar Jul 01 '24 08:07 RocMarshal

I would suggest to add this to checkstyle rules

        <module name="RegexpSinglelineJava">
            <property name="format" value="^import org.jetbrains.annotations."/>
            <property name="message" value="Use import javax.annotation."/>
        </module>

This will fail the build both on ci and local in case of violations

snuyanzin avatar Jul 01 '24 09:07 snuyanzin

I would suggest to add this to checkstyle rules

        <module name="RegexpSinglelineJava">
            <property name="format" value="^import org.jetbrains.annotations."/>
            <property name="message" value="Use import javax.annotation."/>
        </module>

This will fail the build both on ci and local in case of violations

Thanks @snuyanzin for providing the tool.

I'm not sure should we limit all annotations inside of org.jetbrains.annotations. Could we only limit the org.jetbrains.annotations.NotNull and org.jetbrains.annotations.Nullable?

Also @RocMarshal , would you mind squashing all current commits into one commit? They are tiny change, and not deserved to import too many commits. But, adding the checkstyle as a separate commit makes sense to me.

1996fanrui avatar Jul 01 '24 10:07 1996fanrui

I'm not sure should we limit all annotations inside of org.jetbrains.annotations. Could we only limit the org.jetbrains.annotations.NotNull and org.jetbrains.annotations.Nullable?

yes, you can put there the full name like

        <module name="RegexpSinglelineJava">
            <property name="format" value="^import org.jetbrains.annotations.Nullable;$"/>
            <property name="message" value="Use import javax.annotation.Nullable"/>
        </module>

        <module name="RegexpSinglelineJava">
            <property name="format" value="^import org.jetbrains.annotations.NotNull;$"/>
            <property name="message" value="Use import javax.annotation.NotNull"/>
        </module>

snuyanzin avatar Jul 01 '24 10:07 snuyanzin