Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum ordinal can <0? #3339

Closed
1 task done
Bricks-Man opened this issue Jan 25, 2019 · 6 comments
Closed
1 task done

Enum ordinal can <0? #3339

Bricks-Man opened this issue Jan 25, 2019 · 6 comments

Comments

@Bricks-Man
Copy link
Contributor

  • 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?

@CrazyHZM
Copy link
Member

level.ordinal() the initial value is 0

@Bricks-Man
Copy link
Contributor Author

level.ordinal() the initial value is 0

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

@CrazyHZM
Copy link
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.

@cvictory
Copy link
Contributor

cvictory commented Jan 25, 2019 via email

@Bricks-Man
Copy link
Contributor Author

Please join us to commit a pull request to remove this code . huazhongming notifications@github.com 于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.

@kexianjun
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants