r/java • • Mar 19 '19

Java 12 Released !!!

https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html
235 Upvotes

98 comments sorted by

View all comments

110

u/4ipp Mar 19 '19

finalize() methods have been removed...

Looks like the popular interview question about differences between final, finalize and finally is going to die.

69

u/LittleLui Mar 19 '19

Finally.

15

u/SilkTouchm Mar 20 '19

finalize

8

u/LittleLui Mar 20 '19

Don't just hop onto my joke like that. Expect a call from my lawyers. Sometime in the future. Maybe never.

3

u/wengchunkn Mar 20 '19

Finally!!

20

u/uffjedn Mar 19 '19

And being replaced by "Name things that changed in java12" :)

11

u/MrGooglr Mar 19 '19

Isn’t it says that finalize() method is deprecated in java 9 and removed from java 12 for FileInputStream and FileOutputStream and from java.util.zip package.

If I’m not wrong, finalize() is not completely removed.

5

u/dpash Mar 19 '19

Yes, it's just those few classes, but it's a start :)

3

u/irus1024 Mar 20 '19

That's like asking what the differences between a "flywheel, steering wheel, and spare wheel" on a car.

7

u/[deleted] Mar 19 '19

Removed or just deprecated? While I agree with removing them thiswill break a bunch of codebases. My last job we had some really, really horrifying uses of finalize() in legacy code.

16

u/4ipp Mar 19 '19

As I remember, it was deprecated in jdk 9.

The release notes state that it has been removed from many classes. Not sure if that means removing it everywhere.

8

u/GuyWithLag Mar 19 '19

This means that many classes of the JDK/JRE are no longer using finalizers. Complete removal takes some time.

9

u/dpash Mar 19 '19

Removed. They'd been deprecated since Java 9 and in some cases had been turned into no-ops, so didn't do anything anyway.

Yes code will break, but we've been telling people for 20 years not to use finalize.

1

u/[deleted] Mar 20 '19

Agreed about not using finalize. Unfortunately, there is some really, really terrible code out there haha.

2

u/dpash Mar 20 '19

We've all been there and vomited over what we saw there.

2

u/jokeryang Mar 20 '19

Thanks to Oracle:) Good job