Very informative. Always enjoy your content which is conceptually so clear to understand.
@EmmanuelBLONVIA3 ай бұрын
13:38 Introducing a security breach in java solved by records 14:03 When you deserialize an object, no constructor is called 😳 14:30 here's how using record instead of class protect your code from what can be called "deserialization injection" 😌 19:35 Pattern matching 34:08 Using the record components in the pattern matching expression
@MrGabblit2 жыл бұрын
Very insightful, well presented talk
@PietervandenHombergh2 жыл бұрын
Coverage in the switch can be achieved with an anon innner of the Shape in a unit test.
@francksgenlecroyant Жыл бұрын
I think the serialization process is using the Constructor even with regular java classes, the reason why the validation rule is not triggered is because, the constructor which is involved here is the default non-args constructor. That's it!
@DavidBeaumont2 жыл бұрын
I have a question about pattern matching on records (about 35:00). If you use "(Circle radius) -> radius * radius", what happens if you add a new component to Circle (e.g. a colour)? Now the record has a new canonical constructor. And worse, what if the property is the same type as the existing value (e.g. "double celcius"). Now I think that all the callers using pattern matching must update their code with a '_'? I guess (looking ahead) the owner of the type would be responsible for adding an explicit custom pattern to retain the old semantics, but this would be a manual thing you need to remember to do.
@TaranovskiAlex2 жыл бұрын
Thank you for the great talk!
@PanMaciek Жыл бұрын
I love using pattern matching, but seeing how java is going to implement this I'm not sure it will feel great
@GavinFreeborn Жыл бұрын
This summarizes every functional feature java has added. Kinda sad but I guess it's at least there. Unfortunately a poor implementation means it's much harder to sell at work
@khalled95 Жыл бұрын
The main issues in java 17 that companies don't use or upgrade to it, most companies stick with java 8 or 11
@jamesschmames64162 жыл бұрын
I thought it was bad form to throw exceptions in a constructor.
@patrickproctor3462 Жыл бұрын
It should be done judiciously. We use exception throws in constructors for user-provided data so we fail very loudly, very clearly, and in a way that tells our UI developers (and others) that they broke the rules of our API (without resorting to WSDLs which NO ONE wants to maintain).
@OMGitzBadCompany Жыл бұрын
It's far better than knowingly letting invalid objects pop into existence.
@IFraid2 жыл бұрын
So, basically c#
@rsrini7 Жыл бұрын
java becomes another scala
@pierre-jeanmartin56212 жыл бұрын
They should have picked a new language keyword instead of “instanceof”. Something like “ofpattern”. if ( object ofpattern Point(int x, int, y) ) // use x and y Or maybe it’s just me very not liking instanceof 😅
@DavidBeaumont2 жыл бұрын
Adding new keywords is very hard since it's adding a new reserved word to the language specification and might make existing code stop compiling (e.g. if I have a variable or type called "ofpattern". I agree that "instanceof" is a bit unintuitive though, but it might be the pragmatic choice.
@pierre-jeanmartin56212 жыл бұрын
@@DavidBeaumont i understand but it’s not like all modern IDE have a Replace in Files feature. A simple name like record was introduced but a non camel case keyword like « ofpattern » would be a problem 🤨🤔
@DavidBeaumont2 жыл бұрын
@@pierre-jeanmartin5621 what about tools which process Java files or databases containing symbol information of binaries for debugging. There are a lot of potential ways new keywords can mess things up in hard to fix ways. Record is, I think, much easier because it's a new type identifier rather than a language keyword.
@MrKar18 Жыл бұрын
@@pierre-jeanmartin5621what about 10000 if libraries using? You can't modify existing libraries. Java has always been backward compatible. It can't be make or break as its enterprise's go to language.