Skip to content

Enum ordinal can <0? #3339

Closed
Closed

Description

@Bricks-Man
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • [] I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: master
  • Operating System version: deepin 15.9
  • Java version: 8

I want to know more about dubbo.And I found this code in module dubbo-metrics/dubbo-metrics-api/.../MetrcLevel

static {
        for (MetricLevel level : MetricLevel.values()) {
            if (level.ordinal() < 0) {
                throw new RuntimeException("MetricLevel can not < 0");
            }
        }
    }

I think this code is futility.Is it possible of level.ordinal() < 0?

Activity

  1. CrazyHZM commented on Jan 25, 2019

    @CrazyHZM
    Member

    level.ordinal() the initial value is 0

  2. Bricks-Man commented on Jan 25, 2019

    @Bricks-Man
    ContributorAuthor

    level.ordinal() the initial value is 0

    I know it's init with 0, but can it < 0?

  3. CrazyHZM commented on Jan 25, 2019

    @CrazyHZM
    Member

    level.ordinal() the initial value is 0

    I know it's init with 0, but can it < 0?

    I agree with you, this code is futility.

  4. cvictory commented on Jan 25, 2019

    @cvictory
    Contributor
  5. Bricks-Man commented on Jan 25, 2019

    @Bricks-Man
    ContributorAuthor

    Please join us to commit a pull request to remove this code . huazhongming [email protected] 于2019年1月25日周五 上午11:40写道:
    …
    level.ordinal() the initial value is 0 I know it's init with 0, but can it < 0? I agree with you, this code is futility. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#3339 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AD5mbA1t8HBZQXngIiTc_k1dAhJbRAQuks5vGnywgaJpZM4aSFoB .
    -- Best Regard! cvitory

    I have committed a pr.

  6. kexianjun commented on Jan 25, 2019

    @kexianjun
    Member

    closed since this pr #3346 has been merged

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions