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

Victor Rudometov Victor.Rudometov at oracle.com
Thu Oct 22 13:50:56 UTC 2015

On 16-Oct-15 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.

Hi Alex, Sergei,

The JCK test dev for JDK9 t-w-r statement was completed this April with 
665 testcases developed.
I will double check that we've covered cases from Sergei's webrev. F.e. 
I don't recall "array components as variables", we'll have to add such 


> 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