JShell: sealed and final types in jshell
Robert Field
robert.field at oracle.com
Tue May 26 19:50:49 UTC 2020
I have reviewed. Thumbs up!
Thanks,
Robert
On 5/26/20 11:04 AM, Jan Lahoda wrote:
> It would be good to have an explicit approval from Robert. I can send
> a formal RFR here for the JShell part of the patch.
>
> As a note, the most recent patch to add support for sealed types in
> JShell is here:
> https://openjdk.github.io/cr/amber/21/webrev.01/
>
> Besides the JShell tweaks, it also suppresses the "no supertype is
> sealed" error when the non-sealed modifier is used and there are
> erroneous/unresolvable supertypes. This is both to make things (much)
> easier in JShell, and also seems like a good thing to do. If a
> supertype is unresolvable, we don't know if it is sealed or not.
>
> Jan
>
> On 26. 05. 20 19:44, Vicente Romero wrote:
>> well actually if we are OK with the patch it doesn't need another
>> review in compiler-dev
>>
>> Vicente
>>
>> On 5/26/20 8:29 AM, Vicente Romero wrote:
>>> I'm OK with the change, thanks Jan, I will push it into the sealed
>>> types code, for it to be part of the current review.
>>>
>>> Thanks,
>>> Vicente
>>>
>>> On 5/20/20 8:00 PM, Robert Field wrote:
>>>> [adding kulla-dev]
>>>>
>>>> "final" is ignored/warning in jshell to allow maximal
>>>> experimentation. But, in retrospect I think that is probably
>>>> overly heavy handed.
>>>>
>>>> I agree with removing the restriction on "final".
>>>>
>>>> Allowing people to explore new language features is one of explicit
>>>> goals of jshell -- so supporting sealed types is essential.
>>>>
>>>> Side-effect classes which could not be pasted into jshell would be
>>>> able to.
>>>>
>>>> Variables/methods still should probably not be final.
>>>>
>>>> Thoughts?
>>>>
>>>> -Robert
>>>>
>>>>
>>>> On 2020-05-20 10:16, Jan Lahoda wrote:
>>>>> So, I was looking at this today. So far, there are two problems,
>>>>> one simple (permitted classes need to be declaration references).
>>>>> The second problem is more difficult - if we would like this to work:
>>>>> sealed class B permits I {}
>>>>> final class I extends B {}
>>>>>
>>>>> we need to allow the "final" modifier, as having:
>>>>> sealed class B permits I {}
>>>>> class I extends B {}
>>>>>
>>>>> will not work (the class I must either final or non-sealed).
>>>>> Robert, what do you think?
>>>>> ...
>>>>
>>>>> I'll continue looking into this tomorrow.
>>>>>
>>>>> Jan
>>>>>
>>>>> On 19. 05. 20 21:27, Robert Field wrote:
>>>>>> Absolutely! Absolutely!
>>>>>>
>>>>>> Thanks,
>>>>>> Robert
>>>>>>
>>>>>> On 2020-05-19 06:09, Jan Lahoda wrote:
>>>>>>> Vicente, Robert,
>>>>>>>
>>>>>>> Looking at the sealed types, it does not seem support for sealed
>>>>>>> has been added to JShell - should that be added? Should I take a
>>>>>>> look?
>>>>>>>
>>>>>>> Jan
>>>
>>
More information about the kulla-dev
mailing list