JShell: sealed and final types in jshell

Robert Field robert.field at oracle.com
Thu May 21 00:00:27 UTC 2020


[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