@Test public void testIsPackageDescription() throws Exception { assertThat( describe( Class.forName( Sample.class.getPackage().getName() + "." + PackageDescription.PACKAGE_CLASS_NAME)) .isPackageType(), is(true)); assertThat(describe(Object.class).isPackageType(), is(false)); }
private static void resetLambdaClassSequenceNumber() { try { Field counterField = Class.forName("java.lang.invoke.InnerClassLambdaMetafactory").getDeclaredField("counter"); counterField.setAccessible(true); AtomicInteger counter = (AtomicInteger) counterField.get(null); counter.set(0); } catch (Throwable t) { // print to stdout to keep in sync with other log output System.out.println( "WARNING: Failed to start class numbering from one. Don't worry, it's cosmetic, " + "but please file a bug report and tell on which JDK version this happened."); t.printStackTrace(System.out); } }