RFR JDK-8080641: JEP-JDK-8042880 : Implement new tests on Project Coin

Alex Buckley alex.buckley at oracle.com
Mon Oct 19 23:57:07 UTC 2015


I don't see any testing of array components as resources, or testing 
that a resource declared outside the t-w-r statement can either be null 
or is guaranteed to initialize (as discussed in a separate mail).

Alex

On 10/19/2015 8:05 AM, Sergei Pikalev wrote:
>
> Hi All,
>
> http://cr.openjdk.java.net/~shurailine/8080641/webrev.01/
>
> There are updated tests with respect to Alex's remarks.
>
> Thanks,
>      Sergi
>
> On 16.10.2015 02:20, Alex Buckley wrote:
>> Hi Sergei,
>>
>> Most of the new regression tests are about conformance to the spec,
>> rather than probing some javac-internal treatment of the t-w-r
>> statement. I hope someone from JCK-Compiler can comment on their
>> suppor for the expanded t-w-r statement.
>>
>> That said, here are some comments on the new tests:
>>
>> - ResourceVariableOutsideTry - @summary should be "Resource variable
>> should be in scope throughout try, catch, and finally blocks".
>> Accessibility is not relevant to a local variable like c.
>>
>> - TwrAndAnonymousClass - this is a positive test when an anonymous
>> class implements AutoCloseable, but what about a negative test when an
>> anonymous class doesn't implement AutoCloseable?
>>
>> - TwrAndGenerics - should be called TwrAndTypeVariables - plus same
>> comment as above (type variables S and T _not_ extending AutoCloseable).
>>
>> - TwrAndLambda - same comment as above (lambda expressions and method
>> references _not_ implementing AutoCloseable).
>>
>> - TwrVarKinds - good test, but if you're doing to test four kinds of
>> variables then you may as well test all seven (JLS 4.12.3). In
>> particular, array components should be tested. You should test using
>> components from an array of AutoCloseables, and components of
>> components from an array of an array of AutoCloseables. (The second
>> situation in particular will expose any mistreatment of array
>> components by javac -- if javac accidentally erases the array-ness of
>> a resource variable, then in the first situation it will end up with
>> an AutoCloseable and that's ordinary enough that everything might
>> still work, but in the second situation it ends up with an array of
>> AutoCloseables and that might blow up some logic.)
>>
>> - WeirdTwr_WithVar - there is nothing weird or strange here. It's just
>> one resource variable aliasing another, which was possible already.
>> You're right to extend it so that a resource variable declared by
>> 'try' aliases a resource variable declared outside 'try' -- also do it
>> the other way around. Also, need a test where the resource variable
>> declared outside 'try' is null.
>>
>> - What's truly new when a try (...) header uses a resource variable
>> declared outside the 'try'? Answer: no exception can be thrown,
>> whereas the declaration of a resource variable by 'try' includes an
>> initializer expression that can throw an exception. There should be a
>> test to "prove" that try (r1) {...} doesn't throw exceptions from
>> resource initialization, and that try (r1; AutoCloseable r2 = ...)
>> {...} only throws exceptions due to r2's initialization.
>>
>> Alex
>>
>> On 10/14/2015 12:12 AM, Sergei Pikalev wrote:
>>>
>>> Hello,
>>>
>>> This is the code with new Project Coin tests from SQE.
>>>
>>> A webrev with the tests is here:
>>>
>>> http://cr.openjdk.java.net/~shurailine/webrev.8080641/
>>>
>>> Please review.
>>>
>>> Thanks,
>>>      Sergei
>>>
>


More information about the compiler-dev mailing list