mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-26 18:20:28 +00:00
8273140: Replace usages of Enum.class.getEnumConstants() with Enum.values() where possible
Reviewed-by: tschatzl
This commit is contained in:
parent
857a930bde
commit
152e66923d
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 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 final class AttributeValues implements Cloneable {
|
||||
}
|
||||
|
||||
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) 2005, 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
|
||||
@ -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) 2013, 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
|
||||
@ -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 enum JDBCType implements SQLType {
|
||||
* @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) 2014, 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 @@ enum AccessModifier {
|
||||
};
|
||||
|
||||
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 @@ enum Type {
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public String init(Random rnd) {
|
||||
switch (this) {
|
||||
case LONG:
|
||||
@ -222,7 +220,7 @@ enum Type {
|
||||
}
|
||||
|
||||
public static Type getRandomType(Random rnd) {
|
||||
Type[] a = Type.class.getEnumConstants();
|
||||
Type[] a = Type.values();
|
||||
return a[rnd.nextInt(a.length)];
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user