5 ms·
Seems like the least important thing to plug. Everyone that do this knows they're in deep shit anyway, but this is taking away their paddle.
by kpil 9y ago
Seems like the least important thing to plug. Everyone that do this knows they're in deep shit anyway, but this is taking away their paddle.
- didibus 9y agoBut why take away my paddle? Let me have a working solution right away, and when you push an update that breaks my code, let me also deal with fixing it. I'm not dumb, I understand the risk of depending on private APIs.
- lomnakkus 9y ago> But why take away my paddle? Because there are upsides -- a major one being proper implementation hiding and (not sure if this made it in:) "classpath" isolation. > I'm not dumb, I understand the risk of depending on private APIs. Well, you knew the risks, so I'm not sure why you're so upset that Java 9 precludes you using what were ultimately private APIs. It's not possible to have it both ways.
- kpil 9y agoI understand that it's impossible to both implement a rule and not implement a rule, but what is actually the benefit of disabling this? All nerd sleeps safe at night confident that no one changes their private variables? Does this mean that things like jmockit's deencapsulation stops working?
- moomin 9y agoI think the answer is that it allows them to optimise libraries.
- didibus 9y agoThere is none, appart from making the Oracle employees life easier. They don't have to deal with the backlash of breaking customers by accident when touching private APIs, so it gives them more liberty. They decided to take the blow in one go, instead of spread over time. Now, the blow was bigger then they thought, so they've retracted and spread the change over Java 9 and 10, by making 9 an optional setting, and saying 10 will be the cutoff. In an ideal world, it makes sense. This is defensive programming, they're protecting themselves against unplanned usages of their libraries. That's always good when you're a maintainer. You know how annoying it is when you're trying to change and improve things and you realize you can't because someone was using your stuff in a completely dysfunctional way and now you'd break them if you proceeded. But in a practical world, the world of business especially. You should also know that part of the popularity of your software comes from all those use cases users have managed to somehow satisfy without you explicitly planning and building them. Take those away, and your software also loses a lot of value, until you reimplement all these use cases in a more sane way. Tjis will take time, and your customers might move on to something else. We'll see how this impacts Java.
- lomnakkus 9y agoI'm not going to try to convince you, but getting classpath isolation would be a huge deal for my use case. (We could theoretically do OSGi or similar, but that's quite a heavy-handed approach to what should be a simple -- even "default" -- thing).
- TeMPOraL 9y ago> Well, you knew the risks, so I'm not sure why you're so upset that Java 9 precludes you using what were ultimately private APIs. I think this is going too far. You have to jump through enough hoops already to mess with private state of library code; if some developers are dumb enough to do that irresponsibly and get hurt, let them. Don't take away a last-ditch tool those of us who know what we're doing sometimes really need.
- ScottBurson 9y agoYou can always edit the classfile in Emacs :-)
- didibus 9y agoActually, there's an easier way. If you load the class as a resource, it's possible to still access the private methods. Not sure of the details, but I read a blog somewhere who was showing how to do it.
- ScottBurson 9y agoI wasn't serious, of course. Well, I have edited binary executables in Emacs on very rare occasions, but I"ve never tried to edit a classfile. I think there are classfile-modifying libraries one can use if one has to get that down and dirty.
- didibus 9y agoI'm not seeing value in the upsides you mention. I know the risks, but in this case, the private methods' implementation haven't changed, their signature hasn't, it's a completely artificial restriction. That's where the frustration comes from. The code is there, you were allowed to use it, and now you are not, even though the code is still there. If they had refactored, or oprimized, I would understand my code being broken. But this seems more ideological then practical.