RFR 8151705 VarHandle.AccessMode enum names should conform to code style
Michael Haupt
michael.haupt at oracle.com
Fri Apr 8 14:10:23 UTC 2016
Hi Paul,
note this is a lower-case review. Thumbs up, with one remarks (no new webrev required IMO).
* VarHandle.java: static initialiser of AccessMode, comment:
// Initial capacity of # values will is sufficient to avoid resizes
-> remove "will"
Best,
Michael
> Am 07.04.2016 um 15:39 schrieb Paul Sandoz <paul.sandoz at oracle.com>:
>
> 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.
>
--
<http://www.oracle.com/>
Dr. Michael Haupt | Principal Member of Technical Staff
Phone: +49 331 200 7277 | Fax: +49 331 200 7561
Oracle Java Platform Group | LangTools Team | Nashorn
Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany
ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstraße 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Komplementärin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher
<http://www.oracle.com/commitment> Oracle is committed to developing practices and products that help protect the environment
More information about the core-libs-dev
mailing list