< prev index next >

test/jdk/sun/misc/UnsafeFieldOffsets.java

Print this page
rev 58565 : 8238358: Implementation of JEP 371: Hidden Classes
Reviewed-by: duke
Contributed-by: mandy.chung@oracle.com, lois.foltan@oracle.com, david.holmes@oracle.com, harold.seigel@oracle.com, serguei.spitsyn@oracle.com, alex.buckley@oracle.com, jamsheed.c.m@oracle.com
rev 58568 : [mq]: hidden-class-4

*** 63,74 **** String classes = System.getProperty("test.classes"); Path cf = Paths.get(classes, "UnsafeFieldOffsets$Fields.class"); try { byte[] bytes = Files.readAllBytes(cf); Class<?> c = MethodHandles.lookup().defineHiddenClass(bytes, true).lookupClass(); ! if (!c.isHiddenClass()) ! throw new RuntimeException("Expected hidden class: " + c); return c; } catch (IOException e) { throw new UncheckedIOException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); --- 63,73 ---- String classes = System.getProperty("test.classes"); Path cf = Paths.get(classes, "UnsafeFieldOffsets$Fields.class"); try { byte[] bytes = Files.readAllBytes(cf); Class<?> c = MethodHandles.lookup().defineHiddenClass(bytes, true).lookupClass(); ! assertHiddenClass(c); return c; } catch (IOException e) { throw new UncheckedIOException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e);
*** 108,121 **** assertHiddenClass(c); } } private static void assertNonHiddenClass(Class<?> c) { ! if (c.isHiddenClass()) throw new RuntimeException("Expected UOE but not thrown: " + c); } private static void assertHiddenClass(Class<?> c) { ! if (!c.isHiddenClass()) throw new RuntimeException("Expected hidden class but is not: " + c); } } --- 107,120 ---- assertHiddenClass(c); } } private static void assertNonHiddenClass(Class<?> c) { ! if (c.isHidden()) throw new RuntimeException("Expected UOE but not thrown: " + c); } private static void assertHiddenClass(Class<?> c) { ! if (!c.isHidden()) throw new RuntimeException("Expected hidden class but is not: " + c); } }
< prev index next >