Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lsp4e-dev] Move to Java 17 ?

Thanks for sharing, very nice to read your update story.  

Mickael Istria <mistria@xxxxxxxxxx> schrieb am Fr., 26. Aug. 2022, 18:21:
Master is now moving to Java 17, and here is a report:

I changed mostly instanceof (to named ones) and also some switch to switch expressions. This took me ~3 hours. Code is actually looking much better and safer in many places thanks to it: those constructs are less error prone as we cannot mix types in instanceof, save some performance by dereferencing less (which make everything naturally less mutable) and by ensuring we do not forget a `break` or anything else in a switch. So just by looking at the code, those 3 hours are IMO worth it for further maintenance.
Then I ran tests (on CI) and saw some new failures. Annoying you would think? I thought it too. Fortunately, those could easily be reproducible locally. Those were apparently due to Java 17 being stricter with modules than Java 11. I debugged those tests just by putting a breakpoint on the exception and inspecting the trace to find the cause, and found the cause, in the test language server returning a a Future<Future> instead of Future<Object>. OK, easy fix, tests are green. And then I realized that this has been the cause of some flaky or noisy tests earlier, except that some error messages were kind of silented, or discarded, or whatever; yet the language server was still serving buggy content and making the tests something unhappy.
So moving ot Java 17 actually improved the test suite which should become slightly more stable and less noisy. Thank you Java 17; you've always been worth it to me so far!
I'm pretty sure it can be worthy to everyone.

Cheers,
_______________________________________________
lsp4e-dev mailing list
lsp4e-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/lsp4e-dev

Back to the top