logoalt Hacker News

kasperniyesterday at 8:01 PM1 replyview on HN

Strict Field Initialization is opt-in. A flag needs to be set in the classfile in order to enable it. So should not effect any existing code.


Replies

cogman10yesterday at 8:09 PM

It won't bite initially, it will bite when you go to update your version of javac in the future and this becomes the default. Or when you update a library that just so happened to be compiled with a newer version of javac.

This particularly matters when you have something likes this

    class Local {
       private final ThirdPartyObject tpo;
    }
or even something like this

    class Local {
      private final LocalDate ld;
    }
show 1 reply