Java records used in enums

2021-05-21 Thread -
pplication). > Regards, > Alberto. > > De: core-libs-dev en nombre de liangchenb...@gmail.com > Enviado: viernes, 21 de mayo de 2021 17:15 > Para: core-libs-dev@openjdk.java.net > Asunto: Fwd: Java records used in enums > > -- Forwar

Re: Java records used in enums

2021-05-21 Thread Kasper Nielsen
On Fri, 21 May 2021 at 16:00, Alberto Otero Rodríguez wrote: > It seems a non-existent problem until you face it, which is what happened > me today. > > I think at least (supposing enums can't be records) all the fields in > enums should be made final by default. > A suppressible compiler warnin

RE: Java records used in enums

2021-05-21 Thread Alberto Otero Rodríguez
ic methods and static members we had in the application). Regards, Alberto. De: core-libs-dev en nombre de liangchenb...@gmail.com Enviado: viernes, 21 de mayo de 2021 17:15 Para: core-libs-dev@openjdk.java.net Asunto: Fwd: Java records used in enums --

Fwd: Java records used in enums

2021-05-21 Thread -
-- Forwarded message - From: - Date: Fri, May 21, 2021 at 10:14 AM Subject: Re: Java records used in enums To: Alberto Otero Rodríguez I fail to understand what you want. How does making enums records fix the multithreading issue? If you wish to have enums declared like

RE: Java records used in enums

2021-05-21 Thread Alberto Otero Rodríguez
mayo de 2021 16:28 Para: Alberto Otero Rodríguez Cc: core-libs-dev@openjdk.java.net Asunto: Re: Java records used in enums On Fri, 21 May 2021 at 14:51, Alberto Otero Rodríguez mailto:albest...@hotmail.com>> wrote: Hi, I think enums in Java should be immutable. When you let the progra

Re: Java records used in enums

2021-05-21 Thread Robert Marcano
On 5/21/21 10:28 AM, Kasper Nielsen wrote: On Fri, 21 May 2021 at 14:51, Alberto Otero Rodríguez wrote: Hi, I think enums in Java should be immutable. When you let the programmer change values in an enum instance, an unexpected behaviour can happen when using multiple threads as enum instance

Re: Java records used in enums

2021-05-21 Thread Kasper Nielsen
On Fri, 21 May 2021 at 14:51, Alberto Otero Rodríguez wrote: > Hi, > > I think enums in Java should be immutable. When you let the programmer > change values in an enum instance, an unexpected behaviour can happen when > using multiple threads as enum instances are static (singleton). > > So, I w

Java records used in enums

2021-05-21 Thread Alberto Otero Rodríguez
Hi, I think enums in Java should be immutable. When you let the programmer change values in an enum instance, an unexpected behaviour can happen when using multiple threads as enum instances are static (singleton). So, I was wondering why not make enums instances be defined as records instead