From angelos.bimpoudis at oracle.com Fri Aug 30 13:55:50 2024 From: angelos.bimpoudis at oracle.com (Angelos Bimpoudis) Date: Fri, 30 Aug 2024 13:55:50 +0000 Subject: Draft JEP: Primitive Types in Patterns, instanceof, and switch (Second Preview) Message-ID: Dear experts, A draft JEP for the second preview of primitive types in patterns, instanceof, and switch is now available. We propose to preview it for a second time with no changes relative to JDK 23. This feature aligns what instanceof and pattern matching mean across all types. This second preview, unchanged, gives ample time to amber experts to express their feedback. https://bugs.openjdk.org/browse/JDK-8335876 Let us know of your feedback. Thank you, Angelos -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephan.herrmann at berlin.de Fri Aug 30 19:44:13 2024 From: stephan.herrmann at berlin.de (Stephan Herrmann) Date: Fri, 30 Aug 2024 21:44:13 +0200 Subject: Draft JEP: Primitive Types in Patterns, instanceof, and switch (Second Preview) In-Reply-To: References: Message-ID: <562c5120-304b-4d44-b07a-8940224e3be6@berlin.de> The other day I stumbled upon this in the JLS changes for the first preview (JEP 455): * a widening reference conversion followed by an unboxing conversion * a widening reference conversion followed by an unboxing conversion, then followed by a widening primitive conversion I fail to imagine any type that can be widened to a boxing type. What's going on here? best, Stephan Am 30.08.24 um 15:55 schrieb Angelos Bimpoudis: > Dear experts, > > A draft JEP for the second preview of primitive types in patterns, instanceof, > and switch is now available. We propose to preview it for a second time with no > changes relative to JDK 23. This feature aligns what instanceof and pattern > matching mean across all types. This second preview, unchanged, gives ample time > to amber experts to express their feedback. > > https://bugs.openjdk.org/browse/JDK-8335876 > > Let us know of your feedback. > > Thank you, > Angelos From brian.goetz at oracle.com Fri Aug 30 19:47:19 2024 From: brian.goetz at oracle.com (Brian Goetz) Date: Fri, 30 Aug 2024 15:47:19 -0400 Subject: Draft JEP: Primitive Types in Patterns, instanceof, and switch (Second Preview) In-Reply-To: <562c5120-304b-4d44-b07a-8940224e3be6@berlin.de> References: <562c5120-304b-4d44-b07a-8940224e3be6@berlin.de> Message-ID: <0785a6f4-6220-4d8d-9545-81c2c69ff0bc@oracle.com> I had exactly the same confusion when I read those words.? Alex set me straight. ??? int asInt(T t) { return t; } Here, we go from T to Integer (a widening reference conversion), then to int (an unboxing conversion). On 8/30/2024 3:44 PM, Stephan Herrmann wrote: > The other day I stumbled upon this in the JLS changes for the first > preview (JEP 455): > > * a widening reference conversion followed by an unboxing conversion > * a widening reference conversion followed by an unboxing conversion, > then followed by a widening primitive conversion > > I fail to imagine any type that can be widened to a boxing type. > What's going on here? > > best, > Stephan > > > Am 30.08.24 um 15:55 schrieb Angelos Bimpoudis: >> Dear experts, >> >> A draft JEP for the second preview of primitive types in patterns, >> instanceof, and switch is now available. We propose to preview it for >> a second time with no changes relative to JDK 23. This feature aligns >> what instanceof and pattern matching mean across all types. This >> second preview, unchanged, gives ample time to amber experts to >> express their feedback. >> >> https://bugs.openjdk.org/browse/JDK-8335876 >> >> Let us know of your feedback. >> >> Thank you, >> Angelos > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephan.herrmann at berlin.de Fri Aug 30 19:52:22 2024 From: stephan.herrmann at berlin.de (Stephan Herrmann) Date: Fri, 30 Aug 2024 21:52:22 +0200 Subject: Draft JEP: Primitive Types in Patterns, instanceof, and switch (Second Preview) In-Reply-To: <0785a6f4-6220-4d8d-9545-81c2c69ff0bc@oracle.com> References: <562c5120-304b-4d44-b07a-8940224e3be6@berlin.de> <0785a6f4-6220-4d8d-9545-81c2c69ff0bc@oracle.com> Message-ID: <0bb2d4bd-d5e0-4d82-a630-36e41a4db4ea@berlin.de> Thanks for clarifying. FWIW ecj informs me: The type parameter T should not be bounded by the final type Integer. Final types cannot be further extended :) Am 30.08.24 um 21:47 schrieb Brian Goetz: > I had exactly the same confusion when I read those words.? Alex set me straight. > > ??? int asInt(T t) { return t; } > > Here, we go from T to Integer (a widening reference conversion), then to int (an > unboxing conversion). > > On 8/30/2024 3:44 PM, Stephan Herrmann wrote: >> The other day I stumbled upon this in the JLS changes for the first preview >> (JEP 455): >> >> * a widening reference conversion followed by an unboxing conversion >> * a widening reference conversion followed by an unboxing conversion, then >> followed by a widening primitive conversion >> >> I fail to imagine any type that can be widened to a boxing type. What's going >> on here? >> >> best, >> Stephan >> >> >> Am 30.08.24 um 15:55 schrieb Angelos Bimpoudis: >>> Dear experts, >>> >>> A draft JEP for the second preview of primitive types in patterns, >>> instanceof, and switch is now available. We propose to preview it for a >>> second time with no changes relative to JDK 23. This feature aligns what >>> instanceof and pattern matching mean across all types. This second preview, >>> unchanged, gives ample time to amber experts to express their feedback. >>> >>> https://bugs.openjdk.org/browse/JDK-8335876 >>> >>> Let us know of your feedback. >>> >>> Thank you, >>> Angelos >> > From brian.goetz at oracle.com Fri Aug 30 19:55:52 2024 From: brian.goetz at oracle.com (Brian Goetz) Date: Fri, 30 Aug 2024 15:55:52 -0400 Subject: Draft JEP: Primitive Types in Patterns, instanceof, and switch (Second Preview) In-Reply-To: <0bb2d4bd-d5e0-4d82-a630-36e41a4db4ea@berlin.de> References: <562c5120-304b-4d44-b07a-8940224e3be6@berlin.de> <0785a6f4-6220-4d8d-9545-81c2c69ff0bc@oracle.com> <0bb2d4bd-d5e0-4d82-a630-36e41a4db4ea@berlin.de> Message-ID: <624dac97-f8be-439e-83ef-d68a88697470@oracle.com> That's probably a (well intentioned!) ECJ bug! On 8/30/2024 3:52 PM, Stephan Herrmann wrote: > Thanks for clarifying. > > FWIW ecj informs me: > > The type parameter T should not be bounded by the final type Integer. > Final types cannot be further extended > > :) > > Am 30.08.24 um 21:47 schrieb Brian Goetz: >> I had exactly the same confusion when I read those words.? Alex set >> me straight. >> >> ???? int asInt(T t) { return t; } >> >> Here, we go from T to Integer (a widening reference conversion), then >> to int (an unboxing conversion). >> >> On 8/30/2024 3:44 PM, Stephan Herrmann wrote: >>> The other day I stumbled upon this in the JLS changes for the first >>> preview (JEP 455): >>> >>> * a widening reference conversion followed by an unboxing conversion >>> * a widening reference conversion followed by an unboxing >>> conversion, then followed by a widening primitive conversion >>> >>> I fail to imagine any type that can be widened to a boxing type. >>> What's going on here? >>> >>> best, >>> Stephan >>> >>> >>> Am 30.08.24 um 15:55 schrieb Angelos Bimpoudis: >>>> Dear experts, >>>> >>>> A draft JEP for the second preview of primitive types in patterns, >>>> instanceof, and switch is now available. We propose to preview it >>>> for a second time with no changes relative to JDK 23. This feature >>>> aligns what instanceof and pattern matching mean across all types. >>>> This second preview, unchanged, gives ample time to amber experts >>>> to express their feedback. >>>> >>>> https://bugs.openjdk.org/browse/JDK-8335876 >>>> >>>> Let us know of your feedback. >>>> >>>> Thank you, >>>> Angelos >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephan.herrmann at berlin.de Fri Aug 30 19:58:42 2024 From: stephan.herrmann at berlin.de (Stephan Herrmann) Date: Fri, 30 Aug 2024 21:58:42 +0200 Subject: Draft JEP: Primitive Types in Patterns, instanceof, and switch (Second Preview) In-Reply-To: <624dac97-f8be-439e-83ef-d68a88697470@oracle.com> References: <562c5120-304b-4d44-b07a-8940224e3be6@berlin.de> <0785a6f4-6220-4d8d-9545-81c2c69ff0bc@oracle.com> <0bb2d4bd-d5e0-4d82-a630-36e41a4db4ea@berlin.de> <624dac97-f8be-439e-83ef-d68a88697470@oracle.com> Message-ID: <892e7753-67d9-4712-9a9d-70c824c85667@berlin.de> Why should it be a bug to inform the user about bad style? Note, that users are free to chose the severity of this problem as one of Error, Warning, Info or Ignore. Am 30.08.24 um 21:55 schrieb Brian Goetz: > That's probably a (well intentioned!) ECJ bug! > > > On 8/30/2024 3:52 PM, Stephan Herrmann wrote: >> Thanks for clarifying. >> >> FWIW ecj informs me: >> >> The type parameter T should not be bounded by the final type Integer. Final >> types cannot be further extended >> >> :) >> >> Am 30.08.24 um 21:47 schrieb Brian Goetz: >>> I had exactly the same confusion when I read those words.? Alex set me straight. >>> >>> ???? int asInt(T t) { return t; } >>> >>> Here, we go from T to Integer (a widening reference conversion), then to int >>> (an unboxing conversion). >>> >>> On 8/30/2024 3:44 PM, Stephan Herrmann wrote: >>>> The other day I stumbled upon this in the JLS changes for the first preview >>>> (JEP 455): >>>> >>>> * a widening reference conversion followed by an unboxing conversion >>>> * a widening reference conversion followed by an unboxing conversion, then >>>> followed by a widening primitive conversion >>>> >>>> I fail to imagine any type that can be widened to a boxing type. What's >>>> going on here? >>>> >>>> best, >>>> Stephan >>>> >>>> >>>> Am 30.08.24 um 15:55 schrieb Angelos Bimpoudis: >>>>> Dear experts, >>>>> >>>>> A draft JEP for the second preview of primitive types in patterns, >>>>> instanceof, and switch is now available. We propose to preview it for a >>>>> second time with no changes relative to JDK 23. This feature aligns what >>>>> instanceof and pattern matching mean across all types. This second preview, >>>>> unchanged, gives ample time to amber experts to express their feedback. >>>>> >>>>> https://bugs.openjdk.org/browse/JDK-8335876 >>>>> >>>>> Let us know of your feedback. >>>>> >>>>> Thank you, >>>>> Angelos >>>> >>> >> > From forax at univ-mlv.fr Fri Aug 30 21:31:53 2024 From: forax at univ-mlv.fr (Remi Forax) Date: Fri, 30 Aug 2024 23:31:53 +0200 (CEST) Subject: Draft JEP: Primitive Types in Patterns, instanceof, and switch (Second Preview) In-Reply-To: <892e7753-67d9-4712-9a9d-70c824c85667@berlin.de> References: <562c5120-304b-4d44-b07a-8940224e3be6@berlin.de> <0785a6f4-6220-4d8d-9545-81c2c69ff0bc@oracle.com> <0bb2d4bd-d5e0-4d82-a630-36e41a4db4ea@berlin.de> <624dac97-f8be-439e-83ef-d68a88697470@oracle.com> <892e7753-67d9-4712-9a9d-70c824c85667@berlin.de> Message-ID: <516925177.57868451.1725053513730.JavaMail.zimbra@univ-eiffel.fr> ----- Original Message ----- > From: "Stephan Herrmann" > To: "Brian Goetz" , "amber-spec-experts" > Sent: Friday, August 30, 2024 9:58:42 PM > Subject: Re: Draft JEP: Primitive Types in Patterns, instanceof, and switch (Second Preview) Hello Stephan, > Why should it be a bug to inform the user about bad style? > > Note, that users are free to chose the severity of this problem as one of Error, > Warning, Info or Ignore. For me this message by ecj is misleading : - you may want to capture a wildcard bounded by Integer using a named type parameter, List list = ... capture(list); void capture(List list) { ... } - the JLS explicitly says that removing final from a class is a backward compatible change, so maybe in the future the final class will not be a final anymore. That's why a class being final is not something which is part of the type system. regards, R?mi > > > Am 30.08.24 um 21:55 schrieb Brian Goetz: >> That's probably a (well intentioned!) ECJ bug! >> >> >> On 8/30/2024 3:52 PM, Stephan Herrmann wrote: >>> Thanks for clarifying. >>> >>> FWIW ecj informs me: >>> >>> The type parameter T should not be bounded by the final type Integer. Final >>> types cannot be further extended >>> >>> :) >>> >>> Am 30.08.24 um 21:47 schrieb Brian Goetz: >>>> I had exactly the same confusion when I read those words.? Alex set me straight. >>>> >>>> ???? int asInt(T t) { return t; } >>>> >>>> Here, we go from T to Integer (a widening reference conversion), then to int >>>> (an unboxing conversion). >>>> >>>> On 8/30/2024 3:44 PM, Stephan Herrmann wrote: >>>>> The other day I stumbled upon this in the JLS changes for the first preview >>>>> (JEP 455): >>>>> >>>>> * a widening reference conversion followed by an unboxing conversion >>>>> * a widening reference conversion followed by an unboxing conversion, then >>>>> followed by a widening primitive conversion >>>>> >>>>> I fail to imagine any type that can be widened to a boxing type. What's >>>>> going on here? >>>>> >>>>> best, >>>>> Stephan >>>>> >>>>> >>>>> Am 30.08.24 um 15:55 schrieb Angelos Bimpoudis: >>>>>> Dear experts, >>>>>> >>>>>> A draft JEP for the second preview of primitive types in patterns, >>>>>> instanceof, and switch is now available. We propose to preview it for a >>>>>> second time with no changes relative to JDK 23. This feature aligns what >>>>>> instanceof and pattern matching mean across all types. This second preview, >>>>>> unchanged, gives ample time to amber experts to express their feedback. >>>>>> >>>>>> https://bugs.openjdk.org/browse/JDK-8335876 >>>>>> >>>>>> Let us know of your feedback. >>>>>> >>>>>> Thank you, >>>>>> Angelos >>>>> >>>> >>> From stephan.herrmann at berlin.de Fri Aug 30 21:46:25 2024 From: stephan.herrmann at berlin.de (Stephan Herrmann) Date: Fri, 30 Aug 2024 23:46:25 +0200 Subject: Draft JEP: Primitive Types in Patterns, instanceof, and switch (Second Preview) In-Reply-To: <516925177.57868451.1725053513730.JavaMail.zimbra@univ-eiffel.fr> References: <562c5120-304b-4d44-b07a-8940224e3be6@berlin.de> <0785a6f4-6220-4d8d-9545-81c2c69ff0bc@oracle.com> <0bb2d4bd-d5e0-4d82-a630-36e41a4db4ea@berlin.de> <624dac97-f8be-439e-83ef-d68a88697470@oracle.com> <892e7753-67d9-4712-9a9d-70c824c85667@berlin.de> <516925177.57868451.1725053513730.JavaMail.zimbra@univ-eiffel.fr> Message-ID: <0a259a70-1499-4b78-915a-e0e7f350b728@berlin.de> Am 30.08.24 um 23:31 schrieb Remi Forax: > ----- Original Message ----- >> From: "Stephan Herrmann" >> To: "Brian Goetz" , "amber-spec-experts" >> Sent: Friday, August 30, 2024 9:58:42 PM >> Subject: Re: Draft JEP: Primitive Types in Patterns, instanceof, and switch (Second Preview) > > Hello Stephan, > >> Why should it be a bug to inform the user about bad style? >> >> Note, that users are free to chose the severity of this problem as one of Error, >> Warning, Info or Ignore. > > For me this message by ecj is misleading : > - you may want to capture a wildcard bounded by Integer using a named type parameter, > List list = ... and what is the use of the wildcard which can represent exactly one type? > capture(list); > > void capture(List list) { > ... > } > > - the JLS explicitly says that removing final from a class is a backward compatible change, so maybe in the future the final class will not be a final anymore. That's why a class being final is not something which is part of the type system. That's a good point. So this motivates why it is not a mandatory error. But I have never seen anyone use "extends FinalClass" for the purpose of compatibility with future versions of that class. So, it's not a hard error, but in most cases users are better off with simplifying the code. Meanwhile I found one meaningful usage: which some tools interpret as having two instantiations: @Nullable Integer @NonNull Integer :) >> >> >> Am 30.08.24 um 21:55 schrieb Brian Goetz: >>> That's probably a (well intentioned!) ECJ bug! >>> >>> >>> On 8/30/2024 3:52 PM, Stephan Herrmann wrote: >>>> Thanks for clarifying. >>>> >>>> FWIW ecj informs me: >>>> >>>> The type parameter T should not be bounded by the final type Integer. Final >>>> types cannot be further extended >>>> >>>> :) >>>> >>>> Am 30.08.24 um 21:47 schrieb Brian Goetz: >>>>> I had exactly the same confusion when I read those words.? Alex set me straight. >>>>> >>>>> ???? int asInt(T t) { return t; } >>>>> >>>>> Here, we go from T to Integer (a widening reference conversion), then to int >>>>> (an unboxing conversion). >>>>> >>>>> On 8/30/2024 3:44 PM, Stephan Herrmann wrote: >>>>>> The other day I stumbled upon this in the JLS changes for the first preview >>>>>> (JEP 455): >>>>>> >>>>>> * a widening reference conversion followed by an unboxing conversion >>>>>> * a widening reference conversion followed by an unboxing conversion, then >>>>>> followed by a widening primitive conversion >>>>>> >>>>>> I fail to imagine any type that can be widened to a boxing type. What's >>>>>> going on here? >>>>>> >>>>>> best, >>>>>> Stephan >>>>>> >>>>>> >>>>>> Am 30.08.24 um 15:55 schrieb Angelos Bimpoudis: >>>>>>> Dear experts, >>>>>>> >>>>>>> A draft JEP for the second preview of primitive types in patterns, >>>>>>> instanceof, and switch is now available. We propose to preview it for a >>>>>>> second time with no changes relative to JDK 23. This feature aligns what >>>>>>> instanceof and pattern matching mean across all types. This second preview, >>>>>>> unchanged, gives ample time to amber experts to express their feedback. >>>>>>> >>>>>>> https://bugs.openjdk.org/browse/JDK-8335876 >>>>>>> >>>>>>> Let us know of your feedback. >>>>>>> >>>>>>> Thank you, >>>>>>> Angelos >>>>>> >>>>> >>>>