RFR 8152645 VarHandle lookup access control tests

Michael Haupt michael.haupt at oracle.com
Fri Apr 8 13:37:10 UTC 2016

Hi Paul,

note this is a lower-case review. Thumbs up.

I like how the test lucidly documents the access rules, and would applaud an extended test that additionally covers module boundaries.

Just as a suggestion, how about using the fact that enum values are technically instances of subclasses of the enum and getting rid of the switches in FieldLookup.lookup/isAccessibleField by replacing the two with overridden methods in each of the enum elements? Switching over "this" just calls for polymorphism, and the default cases are dead code. Admittedly, it's a matter of style. :-)



> Am 07.04.2016 um 11:07 schrieb Paul Sandoz <paul.sandoz at oracle.com>:
> Hi,
> Please review a test to verify access control of looking up fields using a VarHandle:
>  http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8152645-VH-access-control/webrev/ <http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8152645-VH-access-control/webrev/>
> For completeness i also added tests for MH as i could not find any such existing tests.
> Further follow on work might be to test lookup to fields across module boundaries.
> Paul.


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