jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
changeset 31179 a823fb6fdf2e
parent 31058 fbe6df60e104
child 43893 0e72a2804a0c
equal deleted inserted replaced
31178:6ad68e35506d 31179:a823fb6fdf2e
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test LFGarbageCollectedTest
    25  * @test LFGarbageCollectedTest
    26  * @bug 8046703
    26  * @bug 8046703
       
    27  * @key randomness
    27  * @ignore 8078602
    28  * @ignore 8078602
    28  * @summary Test verifies that lambda forms are garbage collected
    29  * @summary Test verifies that lambda forms are garbage collected
    29  * @author kshefov
    30  * @author kshefov
    30  * @library /lib/testlibrary/jsr292 /lib/testlibrary
    31  * @library /lib/testlibrary/jsr292 /lib/testlibrary
    31  * @build TestMethods
    32  * @build TestMethods
    71             data = testCase.getTestCaseData();
    72             data = testCase.getTestCaseData();
    72             MethodHandle adapter;
    73             MethodHandle adapter;
    73             try {
    74             try {
    74                 adapter = testCase.getTestCaseMH(data, TestMethods.Kind.ONE);
    75                 adapter = testCase.getTestCaseMH(data, TestMethods.Kind.ONE);
    75             } catch (NoSuchMethodException ex) {
    76             } catch (NoSuchMethodException ex) {
    76                 throw new Error("Unexpected exception: ", ex);
    77                 throw new Error("Unexpected exception", ex);
    77             }
    78             }
    78             mtype = adapter.type();
    79             mtype = adapter.type();
    79             Object lambdaForm = INTERNAL_FORM.invoke(adapter);
    80             Object lambdaForm = INTERNAL_FORM.invoke(adapter);
    80             if (lambdaForm == null) {
    81             if (lambdaForm == null) {
    81                 throw new Error("Unexpected error: Lambda form of the method handle is null");
    82                 throw new Error("Unexpected error: Lambda form of the method handle is null");
    92             adapter = null;
    93             adapter = null;
    93 
    94 
    94             collectLambdaForm();
    95             collectLambdaForm();
    95         } catch (IllegalAccessException | IllegalArgumentException |
    96         } catch (IllegalAccessException | IllegalArgumentException |
    96                 InvocationTargetException ex) {
    97                 InvocationTargetException ex) {
    97             throw new Error("Unexpected exception: ", ex);
    98             throw new Error("Unexpected exception", ex);
    98         }
    99         }
    99     }
   100     }
   100 
   101 
   101 
   102 
   102     private void collectLambdaForm() throws IllegalAccessException {
   103     private void collectLambdaForm() throws IllegalAccessException {