RFR 8246337: Add more JVM tests for sealed classes

Lois Foltan lois.foltan at oracle.com
Fri Jun 26 11:54:05 UTC 2020


On 6/25/2020 1:58 PM, Harold Seigel wrote:
> Hi Lois,
>
> Thanks for looking at the changes.  Please see inline comments below.
>
> On 6/25/2020 12:42 PM, Lois Foltan wrote:
>> On 6/22/2020 9:06 AM, Harold Seigel wrote:
>>> Hi,
>>>
>>> Please review this change to add more JVM tests for sealed classes.  
>>> With this change there are now the following set of tests for both 
>>> sealed classes and sealed interfaces.
>>>
>>> 1. Successful tests when both the subclass and its sealed super type
>>>    are in the same module and package and subclass is listed on its
>>>    sealed type's permits list.
>>> 2. Successful tests when both the subclass and its sealed super type
>>>    are in the same module, different package, and the subclass is open
>>>    and is listed on its sealed type's permits list.
>>> 3. Error tests for when the subclass and its sealed super type are in
>>>    different modules and the subclass is listed on its sealed type's
>>>    permits list.
>>> 4. Error tests for when the subclass and its sealed super type are in
>>>    the same module, but different packages, and the subclass is not
>>>    open and the subclass is listed on its sealed type's permit list.
>>> 5. Error tests for when the subclass and its sealed super type are in
>>>    the same module and package but the subclass is not listed on its
>>>    sealed type's permits list.
>>>
>>> Open Webrev: 
>>> http://cr.openjdk.java.net/~hseigel/bug_8246337/webrev/index.html
>>>
>>> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8246337
>>>
>>> The new and modified tests were tested on Linux-x64, Linux-aarch64, 
>>> Windows, and Mac OS X using Mach5.
>>>
>>> Thanks, Harold
>>>
>>>
>>
>> Hi Harold,
>>
>> Good additions to the testing for covering different/same module & 
>> packages.  I would have liked to seen 2 other tests
>>
>> - differing class loaders for a subclass and its sealed super type in 
>> the unnamed module/unnamed package situation.
>>   I assume the test should fail due to differing unnamed modules for 
>> each class loader
> I don't think that such a test is needed because, by definition, if 
> the subclass and its sealed super have different class loaders then 
> they must be in different modules.  And, tests for different modules 
> already exist in this webrev.
>>
>> - also, a nestmates test.  One where the non-public subclass and its 
>> sealed super type are in the same module & package but the super type 
>> is not in the same nest as the subclass.
>>   Again, I assume the test should fail.
>
> Nestmates are not involved with sub-typing so this test would not 
> fail.  Also, since classes without a specified nest host belong to 
> their own nests, this test already exists.  See, for example, the test 
> at line 44 in SealedUnnamedModuleIntfTest.java.
>
> Thanks, Harold

Okay, thanks for the explanation.
Lois

>
>>
>> I'm ok if you want to open a separate RFE for these 2 other tests.
>>
>> Thanks,
>> Lois
>>
>>



More information about the hotspot-runtime-dev mailing list