test/java/lang/invoke/LFCaching/LFCachingTestCase.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File jdk Cdiff test/java/lang/invoke/LFCaching/LFCachingTestCase.java

test/java/lang/invoke/LFCaching/LFCachingTestCase.java

Print this page
rev 11011 : 8057020: LambdaForm caches should support eviction
Reviewed-by: psandoz, ?

*** 61,76 **** --- 61,81 ---- if (lambdaForm0 == null || lambdaForm1 == null) { throw new Error("Unexpected error: One or both lambda forms of the method handles are null"); } if (lambdaForm0 != lambdaForm1) { + // Since LambdaForm caches are based on SoftReferences, GC can cause element eviction. + if (noGCHappened()) { System.err.println("Lambda form 0 toString is:"); System.err.println(lambdaForm0); System.err.println("Lambda form 1 toString is:"); System.err.println(lambdaForm1); throw new AssertionError("Error: Lambda forms of the two method handles" + " are not the same. LF cahing does not work"); + } else { + System.err.println("LambdaForms differ, but there was a GC in between. Ignore the failure."); + } } } catch (IllegalAccessException | IllegalArgumentException | SecurityException | InvocationTargetException ex) { throw new Error("Unexpected exception: ", ex); }
test/java/lang/invoke/LFCaching/LFCachingTestCase.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File