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

8273140: Replace usages of Enum.class.getEnumConstants() with Enum.values() where possible #5303

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
stsypanov marked this conversation as resolved.
Show resolved Hide resolved
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -211,7 +211,7 @@ public static int getMask(EAttribute ... atts) {
}

public static final int MASK_ALL =
getMask(EAttribute.class.getEnumConstants());
getMask(EAttribute.values());

public void unsetDefault() {
defined &= nondefault;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
kevinrushforth marked this conversation as resolved.
Show resolved Hide resolved
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@ public enum EAttribute {
att = ta;
}

/* package */ static final EAttribute[] atts = EAttribute.class.getEnumConstants();
/* package */ static final EAttribute[] atts = EAttribute.values();

public static EAttribute forAttribute(Attribute ta) {
for (EAttribute ea: atts) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
kevinrushforth marked this conversation as resolved.
Show resolved Hide resolved
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -206,7 +206,7 @@ public enum JDBCType implements SQLType {
* The Integer value for the JDBCType. It maps to a value in
* {@code Types.java}
*/
private Integer type;
private final Integer type;

/**
* Constructor to specify the data type value from {@code Types) for
@@ -251,8 +251,8 @@ public Integer getVendorTypeNumber() {
* @see Types
*/
public static JDBCType valueOf(int type) {
for( JDBCType sqlType : JDBCType.class.getEnumConstants()) {
if(type == sqlType.type)
for (JDBCType sqlType : JDBCType.values()) {
if (type == sqlType.type)
return sqlType;
}
throw new IllegalArgumentException("Type:" + type + " is not a valid "
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -169,7 +169,7 @@ public String toString() {
};

public static AccessModifier getRandomAccessModifier(Random rnd) {
AccessModifier[] a = AccessModifier.class.getEnumConstants();
AccessModifier[] a = AccessModifier.values();
return a[rnd.nextInt(a.length)];
}
}
@@ -198,8 +198,6 @@ public String toString() {
}
}

;

public String init(Random rnd) {
switch (this) {
case LONG:
@@ -222,7 +220,7 @@ public String init(Random rnd) {
}

public static Type getRandomType(Random rnd) {
Type[] a = Type.class.getEnumConstants();
Type[] a = Type.values();
return a[rnd.nextInt(a.length)];
}
}