use of java.lang.invoke.MethodHandles.publicLookup in project openj9 by eclipse.
the class LookupInTests method testLookup_inObject_Using_publicLookup.
/**
* Using an old lookup object that was created from a call to MethodHandles.publicLookup(),
* validates access restrictions stored in a new Lookup object created from an old Lookup object
* where the new lookup class is java.lang.Object.
* @throws Throwable
*/
@Test(groups = { "level.sanity" })
public void testLookup_inObject_Using_publicLookup() throws Throwable {
Lookup lookup = PackageExamples.getPublicLookup();
Lookup inObject = lookup.in(int.class);
/*NOTE:
* This is equivalent of the failing test case above, but this one works.
* The only difference is here we are using MethodHandles.publicLookup()
* instead of MethodHandles.lookup() to obtain the original Lookup object.
* */
assertClassAndMode(inObject, int.class, MethodHandles.Lookup.PUBLIC);
}
use of java.lang.invoke.MethodHandles.publicLookup in project openj9 by eclipse.
the class LookupInTests method testPublicLookup.
/**
****************************************
* Basic Sanity tests for Lookup modes
* ***************************************
*/
/**
* Validates public access mode of a Lookup factory created by a call to MethodHandles.publicLookup()
* @throws Throwable
*/
@Test(groups = { "level.sanity" })
public void testPublicLookup() throws Throwable {
assertClassAndMode(localPublicLookup, Object.class, PUBLICLOOKUP_MODE);
Assert.assertEquals(localPublicLookup.lookupModes(), PUBLICLOOKUP_MODE);
Lookup newLookup = localPublicLookup.in(int[].class);
assertClassAndMode(newLookup, int[].class, MethodHandles.Lookup.PUBLIC);
}
Aggregations