RFR 8151705 VarHandle.AccessMode enum names should conform to code style

Paul Sandoz paul.sandoz at oracle.com
Thu Apr 7 13:39:12 UTC 2016


Hi,

Please review:

  http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8151705-VH-AccessMode-names/webrev/

I was persuaded (in internal CCC review) to change the enum VarHandle.AccessMode constant names to conform to the expected Java style.

Previously, for convenience, the names corresponded exactly with the VH sig-poly method names.

Most of the patch is just refactoring.

I have added two new methods to translate to/from the sig-poly method name domain:

1175         /**
1176          * Returns the {@code VarHandle} signature-polymorphic method name
1177          * associated with this {@code AccessMode} value
1178          *
1179          * @return the signature-polymorphic method name
1180          * @see #valueFromMethodName
1181          */
1182         public String methodName() {
1183             return methodName;
1184         }
1185
1186         /**
1187          * Returns the {@code AccessMode} value associated with the specified
1188          * {@code VarHandle} signature-polymorphic method name.
1189          *
1190          * @param methodName the signature-polymorphic method name
1191          * @return the {@code AccessMode} value
1192          * @throws IllegalArgumentException if there is no {@code AccessMode}
1193          *         value associated with method name (indicating the method
1194          *         name does not correspond to a {@code VarHandle}
1195          *         signature-polymorphic method name).
1196          * @see #methodName
1197          */
1198         public static AccessMode valueFromMethodName(String methodName) {
1199             AccessMode am = methodNameToAccessMode.get(methodName);
1200             if (am != null) return am;
1201             throw new IllegalArgumentException("No AccessMode value for method name " + methodName);
1202         }

Paul.




More information about the core-libs-dev mailing list