That and making 'byte' signed.
That and making 'byte' signed.
1) You have no way of knowing that your category method isn't going to collide with another method. That method could be one of Apple's private ones, or it could be a method from a category used by another library you included in your app, or it could be even be from a category used in a jailbreak tweak. In all these cases, it's entirely possible that the colliding method doesn't have the same size arguments or return type as yours, in which case you are going to get extremely difficult to debug crashes. You also don't have guarantees around whose categories win.
2) As a class developer, you have no way of preventing categories from messing up internal guarantees of your class. Want it to be immutable? Too bad, some developer you've never talked to added methods in a category that require local state. Want to add and use a new private method? Too bad, that name is already taken by some random category, and now it looks like your code is breaking everything because it was just committed.
Prefixing category methods is a partial fix, but lots of folks aren't aware that they should do that.
That said: Swift extensions are safer because private categories cannot collide.
Haxe and Scala (and probably many others) have a nice solution to this problem. You can add "methods" to existing classes but only you can see them. You never really change the semantic of something that does not belong to you.
It's true that if you spend a lot of time in Java these things fade into the background, but these are exactly the things that shouldn't fade. You'll never "whip up a quick script" in Java because of these problems.
Personally I think the tooling is the best part of Java. Having an IDE helps you build more robust software by providing far more context than a text editor ever could. The build systems have reached the point that its very easy to do the right thing to build robust software. Compared with what came before (make, imake, configure etc) the tools are much better.
Also, yes, I whip up quick scripts in Java all the time, because sometimes it's the closest hammer to my particular nail. Your entire comment can be summed up as "I don't really understand Java, and I don't like it" which is not a terribly compelling argument.