Java 21

6 views
Skip to first unread message

thomasf

unread,
Dec 13, 2023, 7:03:28 AM12/13/23
to brownies-collections
Unfortunately, GapList is not compatible with Java 21, so I had to revert toArrayList. @Thomas Mauch: Will you be working on an update? Thanks

Thomas Mauch

unread,
Dec 13, 2023, 5:21:44 PM12/13/23
to brownies-collections
Thanks for your message, I'm aware of the compatibility issue.

However the library should be binary compatible, so basically usage should be possible.

You can get compile errors if you try to compile your application with Java 21.
There is an issue with reversed() which can however be mitigated with an explicit cast, see example below.

Can you give me more information which issues you faced and why you had to revert to ArrayList?


void testBrowniesCollectionsJava21() {
IList<String> strs = GapList.create("abc", "def");

// Compiler error
//List<String> strs2 = strs.reversed();

// Ok
List<String> list = ((List<String>) strs).reversed();
Deque<String> deque = ((Deque<String>) strs).reversed();
}
Reply all
Reply to author
Forward
0 new messages