imal () {
throw new UnsupportedOperationException();
}
public String toString () {
return "NaN" ;
}
};
var json = Json.fromUntyped( List . of ( funJsonNumber ));
For me, the Json hierarchy should be implemented with true ADTs, with all
subtypes of JsonValue being records.
regard
- Original Message -
> From: "cay horstmann"
> To: "core-libs-dev"
> Sent: Sunday, May 18, 2025 7:55:12 AM
> Subject: Re: Towards a JSON API for the JDK
Hello Cay,
> +1 for having a JSON battery included with the JDK. And for "Our primary goal
> is
> that the library be simple to use f
It's perhaps easier to just add an annotation @ForceInlining.
regards,
Rémi
> From: "wenshao"
> To: "core-libs-dev"
> Sent: Sunday, May 18, 2025 5:51:15 PM
> Subject: C2 inlining failed because the String constructor is too large
> Through JVM Option +PrintInlining, we found that String has
Hi Paul,
yes, not having a simple JSON API in Java is an issue for beginners.
It's not clear to me why JsonArray (for example) has to be an interface instead
of a record ?
I understand why Json.parse() only works on String and char[] but the API make
it too easy to have many performance issues.
> From: "Brian Goetz"
> To: "Tagir Valeev" , "core-libs-dev"
>
> Sent: Tuesday, May 13, 2025 4:30:33 PM
> Subject: Re: Finding max or min of exactly two objects
> When we did Lambda, we made a few mistakes in the category of adding default
> methods to some "highly abstract" types, such as Funct
> From: "임민수"
> To: "core-libs-dev"
> Sent: Friday, May 9, 2025 10:33:30 AM
> Subject: Unnecessary logic is added to removeFirst and removeLast of
> ArrayList.
> Hi.
> In removeFirst, if size is not 0, the logic is the same as the remove logic.
> removeLast also has the same logic as remove w
Hello,
this is not an overlook,
the less you expose (make public), the easier it is to change the
implementation in the future.
Also, the collection API was design to avoid (if possible) to have more public
methods in the implementation (ArrayList) than you have in the interface
(List).
So
- Original Message -
> From: "Ron Pressler"
> To: "cay horstmann"
> Cc: "core-libs-dev" , "David Alayachew"
>
> Sent: Monday, April 14, 2025 10:30:40 PM
> Subject: Re: My experience using Java to do CLI Scripting
> (moved from amber-dev)
>
> Hi.
>
> This does what you want (and could
Question,
why String.hash and String.hashIsZero are not declared @Stable ?
regards,
Rémi
Hi Per,
last week, at JChateau, we had a one hour session about stable values, I've
build the JDK with this PR so we can discuss about it.
To present the API, i start from the double check locking, rewriting it to use
the StableValue API.
The main remark was that methods like orElseSet() or isS
Just a comment "en passant",
array, List or String in Java tend to use the from/to index convention instead
of the offset+length convention which is the convention for system calls
(read/write etc).
regards,
Rémi
> From: "Roger Riggs"
> To: "core-libs-dev"
> Sent: Monday, March 17, 2025 7
> From: "Viktor Klang"
> To: "Paul Sandoz" , "Fabian Meumertzheim"
>
> Cc: "core-libs-dev"
> Sent: Thursday, February 13, 2025 11:30:59 PM
> Subject: Re: JDK-8072840: Presizing for Stream Collectors
> Indeed. I hope I didn't sound discouraging about the possibility to propagate
> the stream siz
> From: "Glavo"
> To: "core-libs-dev"
> Sent: Thursday, January 30, 2025 4:22:00 PM
> Subject: All classes in jdk.internal.random are not serializable
> Hi,
> My friend was migrating from Random to RandomGenerator, but he ran into a
> roadblock:
> Random is serializable, but those new implementa
Hello Jan,
what you are suggesting is not a backward compatible change.
If we add BigDecimal,valueOf(float), then a program recompiled with the new JDK
may change its behavior,
you can think that the new behavior is more "correct" that the current one, but
changing the behavior of existing pr
What can be done is to have Set.of()/Map.of() to delegate to
SequenceSet.of()/SequenceMap.of() so there is only one implementation at
runtime.
Also, technically, there is a way to change the return type in a binary
compatible way ... if union types are supported in the language.
In that case,
> From: "Rafael Winterhalter"
> To: "core-libs-dev"
> Sent: Thursday, January 16, 2025 8:13:17 AM
> Subject: Factory methods for SequencedSet and SequencedMap
> Hello,
Hello,
> I am happily taking SequencedSet and SequencedMap into use, but one
> inconvenience I encounter is the lack of facto
Hello Victor,
for the Advent of code of yesterday [1], i've this code golfing solution (the
full code is here [2])
var input = ...;
class Node {
final HashMap map = new HashMap<>();
boolean end;
}
var root = new Node();
Arrays.stream(input.substring(0, input.indexOf('\n')).spli
Hello,
as far as i remember, c2 is alble to transform a
try {
Math.somethingExact(...)
} catch(ArithmeticException e) {
...
}
to a jump on overflow ("jo") if the catch and the method call to
Math.somethingExact() are in the same inlining horizon.
If you want a garantee that this optimizat
- Original Message -
> From: "Andrey Turbanov"
> To: "core-libs-dev"
> Sent: Thursday, November 7, 2024 9:17:00 AM
> Subject: Can LinkedHashMap(accessOrder=true) be guarded by ReadWriteLock ?
> Hello.
> I've got a question about LinkedHashMap created with accessOrder=true flag.
> Usually
Hello,
I was discussing with a student, she was trying to use the SortedMap interface
but had trouble with tailMap() no being a strictly higher view from a key.
The solution was to use NavigableMap instead of SortedMap because it provides
more methods to get lower/higher subMap and entries from k
Hello,
the Gatherer API do not provide primitive specialization while intermediate
methods like map(), flatMap() or mapMulti() do.
Unlike collectors where it is okay to not be specialized because most
collectors mutate a collection that is not specialized too,
gatherers can process/transform val
- Original Message -
> From: "Chen Liang"
> To: "core-libs-dev" , "hotspot-dev"
> , kulla-...@openjdk.org
> Sent: Thursday, May 23, 2024 1:28:01 PM
> Subject: Re: RFR: 8242888: Convert dynamic proxy to hidden classes
> On Thu, 23 May 2024 03:28:30 GMT, Chen Liang wrote:
>
>> Please rev
Hello,
for me, it seems what you want is Collector on Stream which is able to
short-circuit,
so you can write
list.stream().collect(Collectors.findFirst(s -> s.contains("o")))
and in reverse
list.reversed().stream().collect(Collectors.findFirst(s -> s.contains("o")))
Using a Stream here is
Hello,
I may have overlook that, but it seems there is no method to see a Collector as
a Gatherer.
A Gatherer is more general than a Collector and a Gatherer with a greedy
integrator that does not call Downstream.push in the intergator and only once
is the finisher is basicaly a Collector.
In
Hello,
this is a minor complaint but I do not see a raison to not getting this right.
Currently the Gatherer API does not use the wildcard correctly, which is not
fully an issue because there is "enough" wildcards that if you rely on the
inference, it will work.
The problem is that when you wri
While doing some benchmarking of the Gatherer API, i've found that the
characteristics of the spliterator was not propagated by the method
Stream.gather() making the stream slower than it should.
As an example, there is no way when reimplementing map() using a Gatherer to
say that this intermed
Hello,
i've played quite a lot with the Gatherer API and overall, i quite like how
things work conceptually.
But i think the public API can be improved.
First, the documentation is not fully clear that a Gatherer has 3
characteristics,
1/ Is it sequential or parallelizable (can be parallel is a
> From: "Viktor Klang"
> To: "David Alayachew" , "core-libs-dev"
>
> Sent: Wednesday, January 10, 2024 2:33:45 PM
> Subject: Re: Gatherers -- conditionalWindowFixed?
> Hi David!
> Apologies for the late reply, there's been lots of catching up to do after the
> holidays.
> >I'm really excited f
> From: "Remi Forax"
> To: "David Alayachew"
> Cc: "core-libs-dev"
> Sent: Wednesday, January 10, 2024 8:19:15 AM
> Subject: Re: Gatherers -- conditionalWindowFixed?
> Hello David,
> testing the gatherer api, I also wanted a "window&
Hello David,
testing the gatherer api, I also wanted a "window" operation as the one you are
describing.
My use cases is a text file with some sections containing items organized like
this
:section1
item1
item2
item3
:section2
item1
item2
...
For me the signature of such method, win
- Original Message -
> From: "Pavel Rappo"
> To: "Roger Riggs"
> Cc: "core-libs-dev"
> Sent: Tuesday, January 2, 2024 5:31:06 PM
> Subject: Re: Blessed modifier order does not include sealed/non-sealed
> Hi Roger,
>
> Happy New Year to you too!
>
> Although it's a _somewhat_ separate
- Original Message -
> From: "Pavel Rappo"
> To: "core-libs-dev"
> Sent: Tuesday, January 2, 2024 12:56:08 PM
> Subject: Blessed modifier order does not include sealed/non-sealed
> I couldn't find any prior discussions on this matter.
>
> I noticed that bin/blessed-modifier-order.sh has
- Original Message -
> From: "Viktor Klang"
> To: "core-libs-dev"
> Sent: Tuesday, November 14, 2023 11:32:48 AM
> Subject: Re: RFR: 8319123: Implementation of JEP-461: Stream Gatherers
> (Preview) [v7]
> On Tue, 14 Nov 2023 09:48:13 GMT, Rémi Forax wrote:
>
>> Hello, the relation
> From: "Viktor Klang"
> To: "Tyler Kindy"
> Cc: "core-libs-dev"
> Sent: Monday, October 30, 2023 10:59:48 PM
> Subject: Re: [External] : Re: Update on JEP-461: Stream Gatherers (Preview)
> That's also a good point, and I've heard from multiple sources that sometimes
> you want to make sure tha
Sorry, you can not do that.
Optional is a value based class [1] (see the javadoc) so the class has to be
final.
And more generally, the API of a classes of OpenJDK will not change based on
some stylistic issue, OOP or not.
regards,
Rémi Forax
[1]
https://docs.oracle.com/en/java/javase/20
- Original Message -
> From: "Uwe Schindler"
> To: "core-libs-dev" , net-...@openjdk.org,
> nio-...@openjdk.org, security-...@openjdk.org
> Sent: Wednesday, July 12, 2023 6:08:17 PM
> Subject: Re: RFR: 8311943: Cleanup usages of toLowerCase() and toUpperCase()
> in java.base [v2]
> On W
oops, sorry, my bad, sending an email when you are deprived of sleep does not
lead to a good outcome.
Remi
On July 7, 2023 4:40:53 PM UTC, Brian Burkhalter wrote:
>On Fri, 7 Jul 2023 16:23:37 GMT, Remi Forax wrote:
>
>> I'm not a big fan of hiding exceptions, why
I'm not a big fan of hiding exceptions, why not wrapping the IOException in an
UncheckedIOException ?
So closeUnchecked() means close and throw an unchecked exception if an
exception occurs.
regards,
Rémi
- Original Message -
> From: "Brian Burkhalter"
> To: "core-libs-dev"
> Sent: T
> From: "Viktor Klang"
> To: "core-libs-dev"
> Sent: Tuesday, June 27, 2023 7:10:42 PM
> Subject: java.util.stream.Stream: API for user-extensible intermediate
> operations
> Hi core-libs-dev,
> Over the past 6+ months I've been thinking about, and tinkering with, how we'd
> be able to expose a
- Original Message -
> From: "David Holmes"
> To: "Raffaello Giulietti" , "core-libs-dev"
>
> Sent: Wednesday, May 24, 2023 12:23:24 AM
> Subject: Re: Classes used in method body are loaded lazily or eagerly
> depending on method return type
> On 24/05/2023 12:50 am, Raffaello Giuli
- Original Message -
> From: "Сергей Цыпанов"
> To: "core-libs-dev"
> Sent: Tuesday, May 23, 2023 1:20:44 PM
> Subject: Classes used in method body are loaded lazily or eagerly depending
> on method return type
> Hello,
Hello,
>
> originally this question was asked here:
> https://st
- Original Message -
> From: "-"
> To: "core-libs-dev"
> Sent: Sunday, May 21, 2023 6:52:44 AM
> Subject: Exposing checked exceptions that a MethodHandle can throw
> Hello,
> I am eliciting a discussion on the feasibility of tracking checked
> exceptions thrown by a MethodHandle. It is a
- Original Message -
> From: "Uwe Schindler"
> To: "core-libs-dev"
> Sent: Tuesday, May 16, 2023 5:38:32 PM
> Subject: JEP 442: Foreign Function & Memory API => why is it again preview
> API?
> Hi,
Hi Uwe,
>
> yesterday Apache Lucene got the information that JDK 21 got the project
>
I've several repositories that now fails to compile with the latest jdk21,
which introduces sequence collections.
The introduction of a common supertype to existing collections is *not* a
source compatible change because of type inference.
Here is a simplified example:
public static void m(L
> From: "Glavo"
> To: "core-libs-dev"
> Sent: Tuesday, April 11, 2023 10:02:01 PM
> Subject: Draft: Deprecate toLowerCase()/toUpperCase() and provide locale
> insensitive alternative
> Hi everyone,
> A few months ago, I discussed in this mailing list[1] whether
> toLowerCase()/toUpperCase() sho
- Original Message -
> From: "Jens Lideström"
> To: "core-libs-dev"
> Sent: Sunday, March 26, 2023 11:38:07 AM
> Subject: Re: The non-deterministic iteration order of Immutable Collections
> I think Map#of and friends would be more useful and less error prone if they
> where to return co
- Original Message -
> From: "Kasper Nielsen"
> To: "Chris Hegarty"
> Cc: "core-libs-dev"
> Sent: Friday, March 24, 2023 6:53:51 PM
> Subject: Re: The non-deterministic iteration order of Immutable Collections
>>
>> I don't (yet) want to be prescriptive in any potential solution. And I
> From: "Brian Goetz"
> To: "Ethan McCue" , "core-libs-dev"
>
> Sent: Tuesday, February 28, 2023 8:48:00 PM
> Subject: Re: JEP-198 - Lets start talking about JSON
> As you can probably imagine, I've been thinking about these topics for quite a
> while, ever since we started working on records an
- Original Message -
> From: "Volker Simonis"
> To: "core-libs-dev" , "hotspot-dev"
>
> Sent: Friday, February 10, 2023 8:03:47 PM
> Subject: Re: RFR: 8302154: Hidden classes created by LambdaMetaFactory can't
> be unloaded [v2]
> On Fri, 10 Feb 2023 17:29:37 GMT, Ioi Lam wrote:
>
>>
> From: "Glavo"
> To: "Stuart Marks"
> Cc: "John Hendrikx" , "core-libs-dev"
>
> Sent: Tuesday, January 31, 2023 10:12:24 PM
> Subject: Re: NPE throwing behavior of immutable collections
> I understand that null is prohibited by default, but can we also provide a set
> of factory methods that a
> From: "Glavo"
> To: "core-libs-dev"
> Sent: Thursday, January 26, 2023 1:35:06 PM
> Subject: [Proposal] Make toLowerCase and toUpperCase based on Locale.ROOT by
> default
> At present, the no-parameter toLowerCase and toUpperCase methods of String are
> based on the default locale.
> I checke
- Original Message -
> From: "Tagir Valeev"
> To: "core-libs-dev"
> Sent: Wednesday, January 25, 2023 2:41:41 PM
> Subject: Math.clamp method?
> Hello!
>
> Quite often it's necessary to clamp a numerical value to a given
> range, using the algorithm like this:
> int clampedValue = value
Hi all,
I don't know if it's the correct way to do it or if there is a better way, but
i'm using
var result = (double) (value & 0x7fffL );
if (value < 0) {
result = result + 9.223372036854776E18;
}
The idea is to mask the sign bit, do the conversion to double and if the sign
b
- Original Message -
> From: "Remi Forax"
> To: "Stuart Marks"
> Cc: "core-libs-dev"
> Sent: Wednesday, November 2, 2022 7:27:02 PM
> Subject: Re: [External] : Re: New candidate JEP: 431: Sequenced Collections
There is also the issue with e
I would like to retract the comments i've made below,
because the first point is now moot and for the second one, after some more
thinking, it may be not that bad and at least the API is very simple to use.
Rémi
> From: "Remi Forax"
> To: "Jim Laskey"
Each time i re-read this JEP, i'm more and more sorry about its state.
- we are breaking how Strings worked, now everything in between "..." is not a
String anymore.
As an example, given a String s, only one of the following lines compiles
System.out.println("s = \{s}".toUpperCase());
System.o
- Original Message -
> From: "mark reinhold"
> To: "Stuart Marks"
> Cc: "core-libs-dev" , "jdk-dev"
>
> Sent: Wednesday, October 12, 2022 1:17:20 AM
> Subject: New candidate JEP: 431: Sequenced Collections
> https://openjdk.org/jeps/431
>
> Summary: Introduce new interfaces to repres
> From: "Ethan McCue"
> To: "John Hendrikx"
> Cc: "core-libs-dev"
> Sent: Wednesday, August 24, 2022 3:38:26 PM
> Subject: Re: Proposal: Collection mutability marker interfaces
> A use case that doesn't cover is adding to a collection.
> Say as part of a method's contract you state that you ta
- Original Message -
> From: "Jan Lahoda"
> To: "core-libs-dev"
> Sent: Friday, August 5, 2022 11:03:06 PM
> Subject: Re: RFR: 8291966: SwitchBootstrap.typeSwitch could be faster
> On Fri, 5 Aug 2022 20:20:56 GMT, Remi Forax wrote:
>
>> You
> From: "(11I10I24) 活 动 中 心" <1015770...@qq.com>
> To: "core-libs-dev"
> Sent: Saturday, August 6, 2022 11:49:18 AM
> Subject: More elegant multi-condition groupby. #9719
> Hi, team
> I have two suggestions
> Firstly:
> If we can provide a new API for grouping ( java.util.stream.Collectors )
>
- Original Message -
> From: "Jan Lahoda"
> To: "core-libs-dev"
> Sent: Friday, August 5, 2022 6:22:48 PM
> Subject: RFR: 8291966: SwitchBootstrap.typeSwitch could be faster
> The pattern matching switches are using a bootstrap method
> `SwitchBootstrap.typeSwitch` to implement the jumps
- Original Message -
> From: "John R Rose"
> To: core-libs-dev@openjdk.org
> Sent: Thursday, July 21, 2022 4:12:14 AM
> Subject: Re: RFR: JDK-8277095 : Empty streams create too many objects [v2]
> On Tue, 16 Nov 2021 20:53:26 GMT, kabutz wrote:
>
>>> This is a draft proposal for how we
62 matches
Mail list logo